Re: Scalability where file uploads are involved

2007-06-07 Thread Nimrod A. Abing

Thanks for this suggestion. Although there would be a slight delay
while the media server syncs up with the Django servers I think this
solution is more feasible.

On 6/8/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> On Fri, 2007-06-08 at 00:38 +0800, Nimrod A. Abing wrote:
> > The only thing I can think of right now is to share a directory on the
> > dedicated media server and have each server in the Django cluster
> > mount that share either through NFS or Samba. But I don't think it's a
> > good idea to do it this way.
>
> Or just copy the images across to the target machine. You could either
> do this as part of your model's save() method or initially store them on
> the Django server and have a cronjob periodically copy them across to
> the analogous directory on the image server.

-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.com/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Confused on how the groups feature works for the Admin interface

2007-06-07 Thread Michael Lake

Hi all

I'm confused on how the groups feature works for the Admin interface.

When I edit a user I can see at the bottom of the page the Groups section with 
a list 
of groups that I have added via the add group function. I can see the two 
groups 
listed in the list; in my case it's honours & postgrads. I can select both and 
then 
click save but nothing happens. There is no indication that the user belongs to 
a 
group. I thought one would have a box like the Available and Chosen user 
permissions 
where one could copy across groups. But all there is is just one box listing 
the groups.

Mike
-- 
Michael Lake




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newforms makes unicode String from a dictonary

2007-06-07 Thread Malcolm Tredinnick

On Fri, 2007-05-25 at 09:19 +1000, Malcolm Tredinnick wrote:
> On Thu, 2007-05-24 at 20:20 +, Christian Schmidt wrote:
> > Hi,
> > 
> > I have a form to upload a picture and i try to validate it in
> > newforms. But i can not read the content-type. I get the error
> > "'unicode' object has no attribute 'get'".
> > 
> > I use Python 2.5. This is my code:
> > 
> > view.py
> > ...
> > postdata = request.POST.copy()
> > if 'bild' in request.FILES:
> > postdata.update(request.FILES)
> > form = EditProfilForm(postdata)
> > if form.is_valid():
> > ...
> > 
> > forms.py
> > ...
> > def clean_bild(self):
> > if self.cleaned_data.get('bild'):
> > image = self.cleaned_data['bild']
> > content_type = image.get('content-type')
> > ...
> > But Image is in this case an unicode String...
> > 
> > Vardump:
> > VariableValue
> > image   u'{\'content\': \'; ***SOME DATA***\', \'content-type\':
> > \'application/octet-stream\', \'filename\': \'myfile\'}'
> > 
> > 
> > Can you tell me how can i get the dictonary out of these unicode
> > strig??
> 
> That is the wrong question. The right question is "why is the value a
> string in the first place?" It should be a dictionary, I would have
> thought.
> 
> This needs some further investigation. If you want to poke around and
> put in some debugging prints, your postdata variable is a QueryDict
> (found in django/http/__init__.py) and the FILES data structure should
> be a MultiValueDict (django/utils/datastructures.py). I can't
> immediately see why it isn't working, but it would be worth trying to
> find out.

I had a brainwave on this yesterday and realised this is a bug in the
unicode branch code. Because we are trying to be nice to forms that
might have unusual encoding, it breaks the case where the POST data is
updated with a FILES dictionary.

I need to rework a large portion of the HttpRequest handling to fix
this, but it will get done in the next couple of days. Not so much for
newforms (since Russell's had some good ideas on the dev list as to how
to avoid the whole update() thing), but for oldforms compatibility, it's
definitely necessary).

Regards,
Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Scalability where file uploads are involved

2007-06-07 Thread Malcolm Tredinnick

On Fri, 2007-06-08 at 00:38 +0800, Nimrod A. Abing wrote:
> Hello,
> 
> I am currently doing research on scaling one of the sites I made using
> Django. I have looked at Chapter 21 of the in-progress Django Book. I
> plan to follow the track recommending 3 django servers behind perlbal
> + 1 dedicated media server + 1 dedicated database server.
> 
> The current setup for the site I am working on uses a single machine
> for the whole site. I have Apache + mod_python on one IP address
> serving Django requests. For media, I have lighttpd running on another
> IP address on the same machine. Postgresql is also running on the same
> machine.
> 
> This site allows users to upload pictures. Those uploaded pictures are
> then served by lighttpd. While this works quite well in our single
> machine setup I am dumbfounded as to how to handle file/image uploads
> when we finally move to a load-balanced setup with a dedicated media
> server.
> 
> The only thing I can think of right now is to share a directory on the
> dedicated media server and have each server in the Django cluster
> mount that share either through NFS or Samba. But I don't think it's a
> good idea to do it this way.

Or just copy the images across to the target machine. You could either
do this as part of your model's save() method or initially store them on
the Django server and have a cronjob periodically copy them across to
the analogous directory on the image server.

Regards,
Malcolm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how do you link two forms to each other?

2007-06-07 Thread rogerdpack

there it is thank you

On Jun 7, 3:09 pm, Paul Rauch <[EMAIL PROTECTED]> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> rogerdpack schrieb:> What if two forms are M2M to each other -- or in some 
> other way need
> > to reference each other?  Possible? Thanks!
> > -Rogerhttp://betterlogic.com/roger
>
> uhm, do you talk about relations?
>
> http://www.djangoproject.com/documentation/model-api/#relationships
>
> greetz Paul Rauch
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.5 (GNU/Linux)
> Comment: Using GnuPG with SUSE -http://enigmail.mozdev.org
>
> iQIVAwUBRmh0ARG67lyyQrltAQJ3jhAAjMaQkUD1egx1PqsvSc6eLIvw423PrfnI
> gUXlsIHnStk8xfvh+t0e0pu8KheIgZ0RhiWCXyO5aA5Q4RHTF901NbxgA7R/6jAL
> XhfU64EADAtd1EFKtrEoky7y1o1gyymJ4sZzZHKBdErMTcpxnuZBzEejq7RpM3DS
> OsaWwkFxsXqzvP68F2gnXYdhN/YyKCRjxmoDGTq0xx2vg3EYp7gktzcDMXjgurB1
> YLZA8+b5RUOUI22ZzYb0PIMEoNyXXBY1xsMBxNT18cEEtAQVv7Nb1YEOHwuke38/
> OGp6HHBO5znL9M2YweWirZ9PJVtshRya4UWyRDTDJaC8Gi1F5sIVNwZazh3uNR2q
> u9KJy/H5Jdo0EQfbkbEWK068IcsE8vjsN5zvEM1mr7EZ8cpZnfSvQN1bYOdTRvOe
> AjXjE2ANMCkE1z69VS28RGwSCCPaObg38bt1FlFiUcU8VTl72aFS8ysgxTLF1VPp
> rBYzgGq2PtVTiYkflZi+gQ6VxeWGN816drF3ceJwwQovVHhz1pjIglVofOiSNudp
> ZEHutQrVcCXvBDoPCZb2NS3GatVKgkKXDhCq/noJszCVn5dc5I2gejVVVtINJoCM
> 17Xj8i3u+Rrkh78T5WPkLkKjD2uHRBcIzWRiSgTkkBERnyF9wnztwXxF3DjUTRUD
> cMwePEijkxU=
> =SWz9
> -END PGP SIGNATURE-


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DBMigrations - an library/tool for database evolution

2007-06-07 Thread Russell Keith-Magee

On 6/8/07, Marinho Brandao <[EMAIL PROTECTED]> wrote:
>
> I think this is a better solution than create a Django contrib or
> another dependent sollution.

Personally, I'd prefer an integrated tool - but I acknowledge that
this is personal preference. Best of luck - this isn't a small problem
:-)

The main reason I pointed out the wiki is that it highlights a well
developed set of use cases. Call it a 'sanity check' on whatever
designs and plans you may have. Regardless of whether your solution is
integrated or standalone, I think you would be well served to be able
to answer the use cases presented on that page.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Admin Date and Time as NewForms Widget

2007-06-07 Thread Michael Trier

Has anyone converted the admin date and time controls to a New Forms
widget format?

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DBMigrations - an library/tool for database evolution

2007-06-07 Thread Marinho Brandao

> Sounds great Marinho, thanks for contributing this! *bookmarked*

thanks for the considerations :)

next days I will have news, that I'll publish in website.

@Russel:

I have seen this wiki, and I've followed the discussions, but the
point that I've percepted is that the ActiveRecord Migrations is very
limited, cos it only supports RoR. My goal is provide a solution more
flexible, and independent of ORMs, platforms or languages.

Example: I'll use DBMigrations to solve a problem that I've with a
Delphi app, and the evolutions of a Django-powered-website case. Two
cases very different, but the DBMigrations will support both.

I think this is a better solution than create a Django contrib or
another dependent sollution.

thanks for all :)

2007/6/6, Kelvin Nicholson <[EMAIL PROTECTED]>:
>
> Sounds great Marinho, thanks for contributing this! *bookmarked*
>
> Kelvin
>
> --
> Kelvin Nicholson
> Voice: +886 9 52152 336
> Voice: +1 503 715 5535
> GPG Keyid: 289090AC
> Data: [EMAIL PROTECTED]
> Skype: yj_kelvin
> Site: http://www.kelvinism.com
>
>
>
> >
>


-- 
José Mário, Mário ou Marinho

http://del.icio.us/marinho
http://www.flickr.com/photos/marinho/
http://marinho.wordpress.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to set up full text field in models.py?

2007-06-07 Thread queezy


Thanks Joseph!  That is what I was doing, but I wondered if there was a 
better way.

Cheers!

-Warren

- Original Message - 
From: "Joseph Heck" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, June 07, 2007 6:02 PM
Subject: Re: How to set up full text field in models.py?


>
> Nothing built in to Django enables that - you have to do it externally
> to the Django framework.
>
> On 6/7/07, Warvin Barker <[EMAIL PROTECTED]> wrote:
>>
>> Hi!
>>
>> I can set up fulltext indices via MySql directly, but is there a way to 
>> do this in models.py?
>>
>> Thanks!
>>
>> -Warren
>>
>> >
>>
>
> > 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Adding a group, and users to that group

2007-06-07 Thread Russell Keith-Magee

On 6/7/07, Vincent Nijs <[EMAIL PROTECTED]> wrote:
>
> Thanks for the help Russ:
>
> That worked. Next problem :) I want to add users to a group.
>
> g = Group.objects.get(name='section81')
>
> gives errors.

I'm guessing the errors you are getting are telling you that various
attributes can't be NULL. Group has a number of attributes other than
'name' - they all need to be specified.

However, it's difficult to say for certain. You could help me out here
by telling me _what_ errors you are receiving. It's difficult to offer
advice when all you're telling me is "it's broken".

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Many to many in template question

2007-06-07 Thread Russell Keith-Magee

On 6/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Figured it out. Template wanted (for whatever reason)
> {% for foo in bar.foos.all %} instead of {% for foo in
> bar.foos_set.all %}

This would all be a lot clearer if you would read the DB-api docs. The
related-objects section explains this aspect of Django in great
detail.

http://www.djangoproject.com/documentation/db-api/#related-objects

In short:
Your Bar model has a foos attribute. Therefore, bar.foos.all().
Your Foo model has an implied attribute, because it is on the
receiving end of a m2m relation with Bar. Therefore,
foo.bar_set.all().

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Data versioning (staging)

2007-06-07 Thread oggie rob

Hi Russ & ringemup,
Thanks for the suggestions. Those are along the lines of what I was
thinking but I can't tell (yet) if there is anything wrong with the
obvious solutions - that's why I was asking :) However I've also
realized this is probably a pretty specific request and it is not all
that likely that others have faced the same issue.
To clarify my situation, although each page may have multiple
versions, a set of pages will be released together. I'm looking at a
separate "Version" model with name/number/ordering field, and a status/
stage field. Then theoretically I can "flip the switch" by changing
the status/stage of the latest Version, and have all the "development"
pages automatically turn into "production" pages (assuming some
validation tests pass, etc). I think I'll also throw in an extra class
so that there is a ManyToMany relationship between the Version and the
Page itself - controlling the name & version link a little more, and
possibly providing a simpler API to access a single list of all Pages
to get the latest.
Like I said though, this is probably pretty specific. I'll just have
to work through it a bit.
Thanks for the help,
 -rob

On Jun 6, 5:49 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 6/6/07, oggie rob <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi all,
> > I have some models and need to add the capability of versioning the
> > data. Basically for each object that represents a page, I want to have
> > a "running" version and an "editing" version of the same page, so that
> > users can see the "approved" version yet I can work on a newer one.
>
> Is there something wrong with the obvious solution - put a 'version'
> attribute on the model definition? The 'editing' version is
> MAX(version), and the 'running' version is MAX(version)-1. Set up your
> urlpatterns so that your /production and /development views filter out
> the appropriate version ID, and provide some helper functions to get
> or create a new editing version.
>
> Alternatively, if you want to be able to maintain multiple editing
> versions, use two fields; a boolean (approved), and an auto_add_now
> datefield. The published version is the most recently modified
> approved object.
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to set up full text field in models.py?

2007-06-07 Thread Joseph Heck

Nothing built in to Django enables that - you have to do it externally
to the Django framework.

On 6/7/07, Warvin Barker <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I can set up fulltext indices via MySql directly, but is there a way to do 
> this in models.py?
>
> Thanks!
>
> -Warren
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to set up full text field in models.py?

2007-06-07 Thread Warvin Barker

Hi!

I can set up fulltext indices via MySql directly, but is there a way to do this 
in models.py?

Thanks!

-Warren

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Model Method Regular Expressions

2007-06-07 Thread hass

I'm trying to set up a model with a field that swallows a healthy
dollop of html, such as a youtube embed code.

But then, I want to use regular expressions to strip that code into
pieces that I can access independently.  My first thought is that some
regular expression kungfu could do that parsing and then store it as
models fields.

Would it make sense to do this as a model method? Would that do the
parsing repeatedly, and not just when the object is added?

Where would you have the regular expressions run?

thanks for your help.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how do you link two forms to each other?

2007-06-07 Thread Paul Rauch

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

rogerdpack schrieb:
> What if two forms are M2M to each other -- or in some other way need
> to reference each other?  Possible? Thanks!
> -Roger http://betterlogic.com/roger
> 
> 
> > 
> 
uhm, do you talk about relations?

http://www.djangoproject.com/documentation/model-api/#relationships

greetz Paul Rauch
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iQIVAwUBRmh0ARG67lyyQrltAQJ3jhAAjMaQkUD1egx1PqsvSc6eLIvw423PrfnI
gUXlsIHnStk8xfvh+t0e0pu8KheIgZ0RhiWCXyO5aA5Q4RHTF901NbxgA7R/6jAL
XhfU64EADAtd1EFKtrEoky7y1o1gyymJ4sZzZHKBdErMTcpxnuZBzEejq7RpM3DS
OsaWwkFxsXqzvP68F2gnXYdhN/YyKCRjxmoDGTq0xx2vg3EYp7gktzcDMXjgurB1
YLZA8+b5RUOUI22ZzYb0PIMEoNyXXBY1xsMBxNT18cEEtAQVv7Nb1YEOHwuke38/
OGp6HHBO5znL9M2YweWirZ9PJVtshRya4UWyRDTDJaC8Gi1F5sIVNwZazh3uNR2q
u9KJy/H5Jdo0EQfbkbEWK068IcsE8vjsN5zvEM1mr7EZ8cpZnfSvQN1bYOdTRvOe
AjXjE2ANMCkE1z69VS28RGwSCCPaObg38bt1FlFiUcU8VTl72aFS8ysgxTLF1VPp
rBYzgGq2PtVTiYkflZi+gQ6VxeWGN816drF3ceJwwQovVHhz1pjIglVofOiSNudp
ZEHutQrVcCXvBDoPCZb2NS3GatVKgkKXDhCq/noJszCVn5dc5I2gejVVVtINJoCM
17Xj8i3u+Rrkh78T5WPkLkKjD2uHRBcIzWRiSgTkkBERnyF9wnztwXxF3DjUTRUD
cMwePEijkxU=
=SWz9
-END PGP SIGNATURE-

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how do you link two forms to each other?

2007-06-07 Thread rogerdpack

ha ha I said forms I meant classes (i.e. in your models.py file).

On Jun 7, 3:02 pm, rogerdpack <[EMAIL PROTECTED]> wrote:
> What if two forms are M2M to each other -- or in some other way need
> to reference each other?  Possible? Thanks!
> -Rogerhttp://betterlogic.com/roger


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



preserve ordering in filtering

2007-06-07 Thread cesco

Hi,
I have the following query which I cannot implement with the django
model API because I need to order it according to a calculated field.

query = """SELECT id FROM offers_offer AS f1
ORDER BY (f1.original_price-f1.discounted_price) DESC
LIMIT 20"""
cursor = connection.cursor()
cursor.execute(query)
offers_list = cursor.fetchall()
offers_list_ids = [row[0] for row in offers_list]
qs = Offer.objects.filter(id__in=offers_list_ids)

The "cursor.fetchall()" method returns the ids in the right order
(according to the difference between original_price and
discounted_price) but the objects.filter method reorders the objects
according to the primary key.
How can I preserve the ordering obtained in the first place?
If that's not possible how can I reorder the queryset after the
filtering?
Is there another way of returning ordered objects for the feeds class
besides returning a queryset? (we are sending the queryset to an RSS
feed class)

Any help would be appreciated.

Thanks
Francesco


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using Ajax to edit my admin page

2007-06-07 Thread Greg

I'm building a site where I'm going to have 10 manufacturers and each
of those manufacturers is going to have 10 collections and each of
those collections will contain 20 style.  Confused Yet?

In my admin i have a table called styles.  It looks like this:

class Style(models.Model):
name = models.CharField(maxlength=200)
theslug = models.SlugField(prepopulate_from=('name',))
manufacturer = models.ForeignKey(Manufacturer)
collection = models.ForeignKey(Collection)
sandp = models.ManyToManyField(Choice)

class Admin:
search_fields = ['name']
list_filter = ('collection',)
list_display = ('name', 'theslug','collection', 'rmanu')

js = (
'/site_media/ajax_yahoo.js',
)

def __str__(self,):
return self.name

def rmanu(self):
return self.collection.manufacturer


We'll when I'm entering a style I want to be able to select a
manufacturer and then the collection drop-down list only shows those
collections that are tied to the manufacturer that I selected.  I'm
guessing that I'm going to need to use AJAX to accomplish this

I already have it setup to where when I'm in the admin and I'm adding
a style when I select a manufacturer a alert pops up.  So I know that
my YUI addlisteners is working.  I get confused on the part on how I
would update my collection form field with only those entries that are
tied to the manufacturer I selected.  Do I need to have a function
within my ajax.js file which call a Django view?  How would that
Django view update the contents of my collection form field?

I know these are some tough questions...but would very much appreciate
it if somebody could help me out.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: classes

2007-06-07 Thread Joseph Heck

.__class__

On 6/7/07, Lic. José M. Rodriguez Bacallao <[EMAIL PROTECTED]> wrote:
> how can I know insede a method the type of my class dynamicaly?
>
> --
> Lic. José M. Rodriguez Bacallao
> Cupet
>  >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



classes

2007-06-07 Thread Lic. José M. Rodriguez Bacallao
how can I know insede a method the type of my class dynamicaly?

-- 
Lic. José M. Rodriguez Bacallao
Cupet

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: [django-users] FileBrowser v 2.0

2007-06-07 Thread Michael Trier

Very Nice!  Thanks for your work.

Michael

On 6/7/07, patrick k. <[EMAIL PROTECTED]> wrote:
>
>
> Am 07.06.2007 um 19:24 schrieb Simon Drabble:
>
> > On Thu, 7 Jun 2007, patrickk wrote:
> >
> >>
> >> I´ve just released a new version of the filebrowser:
> >> http://trac.dedhost-sil-076.sil.at/trac/filebrowser/wiki
> >>
> >> things to come:
> >> ### i18n
> >> ### integration of snipshot and picnik for basic image-editing
> >> (already working on that one)
> >>
> >> thanks,
> >> patrick.
> >
> >
> > Patrick,
> >
> > Are you planning on/ do you have any support for tagging? I'm working
> > on a (very alpha) personal file management app geared towards photos,
> > audioclips, and movies, the prime motivator being to allow easy
> > tagging
> > of large sets of files.
> >
> > No sense duplicating wheel-construction so if you have tagging support
> > planned or available I may take a look at your app.
>
> sounds interesting, but the FileBrowser is basically an extension to
> the admin-interface,
> so I think it´s a bit "out of scope".
>
> I won´t say that it´s never going to happen, but there´s more
> important stuff to fix before.
>
> patrick.
>
> >
> > -Simon.
> > >
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Users Portuguese

2007-06-07 Thread Guilherme Mesquita Gondim (semente)
On 6/7/07, Marinho Brandao <[EMAIL PROTECTED]> wrote:

> mas também acho que é sempre bom ter variedade e tentar integrar
> pessoas, então por esse lado, a idéia da lista é boa.

É, este é o objetivo.

> Vou entrar na
> lista sim, mas minha dedicação vai continuar maior na django-brasil,
> pra não pulverizar os esforços :)

Tá certo. Acho que as coisas vão acontecer naturalmente. Por isso
mesmo eu não propus que ninguém faça algum esforço e etc. Eu só acho
que vai vingar se tiver participação de fora do Brasil e será bastante
interessante pra todo mundo. É esperar pra ver. Caso contrário,
continuará tudo como está.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



reduce execution time of object.count()

2007-06-07 Thread Paul Rauch

Is there a way to reduce execution time by counting objects?

it's even splitted in two queries now, with only 2474487 entries ;)

in django I use "model.objects.count()"

SELECT COUNT(*) FROM "rainbowtables_hashes":34.552

SELECT COUNT(*) FROM "rainbowtables_hashes":31.024

greetz Paul Rauch

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: [django-users] FileBrowser v 2.0

2007-06-07 Thread patrick k.


Am 07.06.2007 um 19:24 schrieb Simon Drabble:

> On Thu, 7 Jun 2007, patrickk wrote:
>
>>
>> I´ve just released a new version of the filebrowser:
>> http://trac.dedhost-sil-076.sil.at/trac/filebrowser/wiki
>>
>> things to come:
>> ### i18n
>> ### integration of snipshot and picnik for basic image-editing
>> (already working on that one)
>>
>> thanks,
>> patrick.
>
>
> Patrick,
>
> Are you planning on/ do you have any support for tagging? I'm working
> on a (very alpha) personal file management app geared towards photos,
> audioclips, and movies, the prime motivator being to allow easy  
> tagging
> of large sets of files.
>
> No sense duplicating wheel-construction so if you have tagging support
> planned or available I may take a look at your app.

sounds interesting, but the FileBrowser is basically an extension to  
the admin-interface,
so I think it´s a bit "out of scope".

I won´t say that it´s never going to happen, but there´s more  
important stuff to fix before.

patrick.

>
> -Simon.
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: IntegrityError: null value in column "id" when inserting via admin

2007-06-07 Thread omat

By the way, I suspect that during moving existing data into the new
database, somethings might have been broken, like auto incrementation
sequences.
But, although I experimented with them a little, it didn't help.



On 7 Haziran, 21:07, omat <[EMAIL PROTECTED]> wrote:
> My application is working in the development environment. I deployed
> the application in the production and copied the data in Posetgresql
> db.
>
> When I try to insert a new "Page" using the admin application, I
> receive an "IntegrityError: null value in column "id" violates not-
> null constraint".
>
> Any ideas?
>
> Thanks...
>
> The "Page" model class is as follows:
>
> class Page(models.Model):
> title = models.CharField('Başlık',
>  maxlength = 100,
>  core = True,
>  db_index = True)
> slug = models.SlugField(prepopulate_from = ('title',))
> body = models.TextField(blank = True,
> null = True)
> sections = models.ManyToManyField(Section,
>   blank = True,
>   null = True)
>
> And this is the traceback:
>
> Traceback (most recent call last):
>
>  File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py",
> line 77, in get_response
>response = callback(request, *callback_args, **callback_kwargs)
>
>  File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/
> decorators.py", line 55, in _checklogin
>return view_func(request, *args, **kwargs)
>
>  File "/usr/lib/python2.4/site-packages/django/views/decorators/
> cache.py", line 39, in _wrapped_view_func
>response = view_func(request, *args, **kwargs)
>
>  File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/
> main.py", line 254, in add_stage
>new_object = manipulator.save(new_data)
>
>  File "/usr/lib/python2.4/site-packages/django/db/models/
> manipulators.py", line 108, in save
>new_object.save()
>
>  File "/usr/lib/python2.4/site-packages/django/db/models/base.py",
> line 243, in save
>','.join(placeholders)), db_values)
>
> IntegrityError: null value in column "id" violates not-null constraint


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



IntegrityError: null value in column "id" when inserting via admin

2007-06-07 Thread omat

My application is working in the development environment. I deployed
the application in the production and copied the data in Posetgresql
db.

When I try to insert a new "Page" using the admin application, I
receive an "IntegrityError: null value in column "id" violates not-
null constraint".

Any ideas?

Thanks...


The "Page" model class is as follows:

class Page(models.Model):
title = models.CharField('Başlık',
 maxlength = 100,
 core = True,
 db_index = True)
slug = models.SlugField(prepopulate_from = ('title',))
body = models.TextField(blank = True,
null = True)
sections = models.ManyToManyField(Section,
  blank = True,
  null = True)


And this is the traceback:


Traceback (most recent call last):

 File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py",
line 77, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/
decorators.py", line 55, in _checklogin
   return view_func(request, *args, **kwargs)

 File "/usr/lib/python2.4/site-packages/django/views/decorators/
cache.py", line 39, in _wrapped_view_func
   response = view_func(request, *args, **kwargs)

 File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/
main.py", line 254, in add_stage
   new_object = manipulator.save(new_data)

 File "/usr/lib/python2.4/site-packages/django/db/models/
manipulators.py", line 108, in save
   new_object.save()

 File "/usr/lib/python2.4/site-packages/django/db/models/base.py",
line 243, in save
   ','.join(placeholders)), db_values)

IntegrityError: null value in column "id" violates not-null constraint


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Users Portuguese

2007-06-07 Thread Marinho Brandao

bom, eu repito minha opinião original: pulverizar os esforços tende a
atrapalhar (é que nem pinguim: só sobrevive em grupos unidos, se cada
um sai pra um lado, todos morrem). francamente eu sempre temo quando
existem vários caminhos, a tendencia é os dois enfraqueceram.

mas também acho que é sempre bom ter variedade e tentar integrar
pessoas, então por esse lado, a idéia da lista é boa. Vou entrar na
lista sim, mas minha dedicação vai continuar maior na django-brasil,
pra não pulverizar os esforços :)

2007/6/7, Guilherme Mesquita Gondim (semente) <[EMAIL PROTECTED]>:
>
> On 6/7/07, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
> >
> > Have you seen the existing `Django Brasil`__ group? It's got 165
> > members and seems pretty active.
> >
> > .. __: http://groups.google.com/group/django-brasil
>
> Yes, I am member of the Django Brasil.
>
> The idea with this group is congregate brazilians, portugueses and any
> another speak of the portuguese language, independent of the your
> nacionality.
>
> The Django Brasil discuss about events, services and meetings in Brazil.
>
> >
>


-- 
José Mário, Mário ou Marinho

http://del.icio.us/marinho
http://www.flickr.com/photos/marinho/
http://marinho.wordpress.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Many to many in template question

2007-06-07 Thread [EMAIL PROTECTED]

Figured it out. Template wanted (for whatever reason)
{% for foo in bar.foos.all %} instead of {% for foo in
bar.foos_set.all %}

On Jun 7, 12:09 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I'm just getting more and more stumped.
>
> I went ahead and created a custom view for Foo, so that's taken care
> of, but Bar (which should be easy) isn't working either.
>
> I have:
> class Bar(models.Model):
> name= models.CharField(maxlength=100)
> foos = models.ManyToManyField(Foo,
> filter_interface=models.HORIZONTAL, related_name="foos", null=True,
> blank=True)
> slug = models.SlugField(prepopulate_from=('name',))
>
> In passing it in a generic view, in the template, shouldn't I just be
> able to do this?
>
> {% for foo in bar.foos_set.all %}
> test
> {% endfor %}
>
> I get nothing. If I put in {{ bar.foos_set.all }} I get an object
> pointer, not a list.
> I haven't thrown any errors when I ran syncdb or validate.
>
> On Jun 7, 8:58 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> wrote:
>
> > On 6/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > That's what I thought, too, but I can't seem to access it. Maybe I
> > > need to just write a custom view for this page.
>
> > Based on what you've said so far, you shouldn't need to write a new
> > view. You just need to reference the m2m data correctly. Assuming you
> > have the models:
>
> > class Foo(models.Model):
> > name = models.CharField()
>
> > class Bar(models.Model):
> > name = models.CharField()
> > foos =  models.ManyToManyField(Foo)
>
> > Then you can, in view code, ask for:
>
> > >>> Foo.objects.all()
> > >>> Bar.objects.all()
> > >>> mybar.foos.all()
> > >>> myfoo.bar_set.all()
>
> > And in template, if you have mybar and myfoo into the context, you can 
> > write:
> > {{ mybar }}
> > {{ myfoo }}
> > {% for foo in mybar.foos.all %}
> > {{ foo.name }}
> > {% endfor %}
> > {% for bar in myfoo.bar_set.all }
> > {{ bar.name }}
> > {% endfor %}
>
> > Yours,
> > Russ Magee %-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newforms makes unicode String from a dictonary

2007-06-07 Thread hernan43

On May 24, 4:20 pm, Christian Schmidt <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I have a form touploada picture and i try to validate it innewforms. But i 
> can not read the content-type. I get the error
> "'unicode' object has no attribute 'get'".
>

I had the same problem. I was using a forms.CharField with a
widget=forms.FileInput. This was causing django to turn the file
upload dictionary into a unicode string. I changed forms.CharField to
forms.Field and now it is working fine.
--Ray


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: [django-users] FileBrowser v 2.0

2007-06-07 Thread Simon Drabble
On Thu, 7 Jun 2007, patrickk wrote:

>
> I´ve just released a new version of the filebrowser:
> http://trac.dedhost-sil-076.sil.at/trac/filebrowser/wiki
>
> things to come:
> ### i18n
> ### integration of snipshot and picnik for basic image-editing
> (already working on that one)
>
> thanks,
> patrick.


Patrick,

Are you planning on/ do you have any support for tagging? I'm working
on a (very alpha) personal file management app geared towards photos,
audioclips, and movies, the prime motivator being to allow easy tagging
of large sets of files.

No sense duplicating wheel-construction so if you have tagging support
planned or available I may take a look at your app.

-Simon.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Many to many in template question

2007-06-07 Thread [EMAIL PROTECTED]

I'm just getting more and more stumped.

I went ahead and created a custom view for Foo, so that's taken care
of, but Bar (which should be easy) isn't working either.

I have:
class Bar(models.Model):
name= models.CharField(maxlength=100)
foos = models.ManyToManyField(Foo,
filter_interface=models.HORIZONTAL, related_name="foos", null=True,
blank=True)
slug = models.SlugField(prepopulate_from=('name',))

In passing it in a generic view, in the template, shouldn't I just be
able to do this?

{% for foo in bar.foos_set.all %}
test
{% endfor %}

I get nothing. If I put in {{ bar.foos_set.all }} I get an object
pointer, not a list.
I haven't thrown any errors when I ran syncdb or validate.



On Jun 7, 8:58 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 6/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> > That's what I thought, too, but I can't seem to access it. Maybe I
> > need to just write a custom view for this page.
>
> Based on what you've said so far, you shouldn't need to write a new
> view. You just need to reference the m2m data correctly. Assuming you
> have the models:
>
> class Foo(models.Model):
> name = models.CharField()
>
> class Bar(models.Model):
> name = models.CharField()
> foos =  models.ManyToManyField(Foo)
>
> Then you can, in view code, ask for:
>
> >>> Foo.objects.all()
> >>> Bar.objects.all()
> >>> mybar.foos.all()
> >>> myfoo.bar_set.all()
>
> And in template, if you have mybar and myfoo into the context, you can write:
> {{ mybar }}
> {{ myfoo }}
> {% for foo in mybar.foos.all %}
> {{ foo.name }}
> {% endfor %}
> {% for bar in myfoo.bar_set.all }
> {{ bar.name }}
> {% endfor %}
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



FileBrowser v 2.0

2007-06-07 Thread patrickk

I´ve just released a new version of the filebrowser:
http://trac.dedhost-sil-076.sil.at/trac/filebrowser/wiki

I´ve tested it and it works fine with my settings (OSX with firefox  
2, safari 2, opera 9) - however, additional testing is never senseless.
so, if you find the time to do some testing, please give me some  
feedback ...

list of updates/improvements:
### better coding (well, ...) and improved readability of the code
### renaming files is now possible
### thumbnails are clickable (also when using the FileBrowseField)
### make thumbs for a whole directory
### seperate settings-file (fb_settings.py) - maybe the settings will  
be stored in the database with the next version
### set thumbnail size
### improved thumbnail quality
### improved error handling with multiple file upload
### and some other minor updates/improvements

notes:
### the filebrowser is prepared for i18n, although it´s not fully  
integrated yet

things to come:
### i18n
### integration of snipshot and picnik for basic image-editing  
(already working on that one)

where the community could help:
### check the english phrases before i18n is done (since english is  
not my first language, that´d be very helpful)
### testing with different browsers (esp. the js-section with the  
FileBrowseField and TinyMCE)
### if someone is able to do a FileBrowseField that´d be great (so we  
can get rid of the javascript-hooks) - unfortunately, I don´t have  
the time and knowledge doing that
### integrating patch for large streaming uploads resp. upload  
progress bar
### don´t know if it makes sens to use newforms for multiple file-upload

thanks,
patrick.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Users Portuguese

2007-06-07 Thread Guilherme Mesquita Gondim (semente)

On 6/7/07, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
>
> Have you seen the existing `Django Brasil`__ group? It's got 165
> members and seems pretty active.
>
> .. __: http://groups.google.com/group/django-brasil

Yes, I am member of the Django Brasil.

The idea with this group is congregate brazilians, portugueses and any
another speak of the portuguese language, independent of the your
nacionality.

The Django Brasil discuss about events, services and meetings in Brazil.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Scalability where file uploads are involved

2007-06-07 Thread Nimrod A. Abing

Hello,

I am currently doing research on scaling one of the sites I made using
Django. I have looked at Chapter 21 of the in-progress Django Book. I
plan to follow the track recommending 3 django servers behind perlbal
+ 1 dedicated media server + 1 dedicated database server.

The current setup for the site I am working on uses a single machine
for the whole site. I have Apache + mod_python on one IP address
serving Django requests. For media, I have lighttpd running on another
IP address on the same machine. Postgresql is also running on the same
machine.

This site allows users to upload pictures. Those uploaded pictures are
then served by lighttpd. While this works quite well in our single
machine setup I am dumbfounded as to how to handle file/image uploads
when we finally move to a load-balanced setup with a dedicated media
server.

The only thing I can think of right now is to share a directory on the
dedicated media server and have each server in the Django cluster
mount that share either through NFS or Samba. But I don't think it's a
good idea to do it this way.

Does anyone know how else this can be done?

Thanks in advance.
-- 
_nimrod_a_abing_

http://www.preownedcar.com/
http://abing.gotdns.com/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Taking a patch

2007-06-07 Thread brian corrigan

Thanks for your help Russ. Turns out that the last .diff fitted in to
the version of django I had so there is no need to add to the ticket.
If anyone else is looking to take the big int patch its very simple.

Cheers again Russ and to everyone who contributed to the ticket...
very helpful

Brian

On Jun 7, 3:06 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 6/7/07, brian corrigan <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hey all,
>
> > I am looking to take in the patches for ticket #399 (BigInt field). I
> > am not sure how to do this though. There is an original patch.txt
> > followed by a couple of .diff files. Are the .diff files the
> > difference between the original source and the latest update to the
> > patch or are they the .diff since the last patch?
>
> Depends on who made the patch. However, generally speaking, each patch
> will be self contained, unless otherwise noted in the ticket comments.
>
> > Also the original patch is from 2 years ago and a lot has changed
> > since then so I'm a little confused as to how I would go about taking
> > in this patch.
>
> Unless the area of code affected by the patch hasn't changed much
> (which isn't very likely), the diff won't apply cleanly, so you'll
> need to port the patch. Look at what code is being added by the patch,
> try to find the analogous code in the current trunk, and manually
> insert the code from the patch into your copy of the trunk code.
>
> When you're done, don't forget to take a new diff and upload it to the
> ticket so that others can share in your efforts.
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Making Windows XP Start 60% Faster

2007-06-07 Thread Stranger

Making Windows XP Start 60% Faster

Whenever you start your computer, you are faced with a few moments of
thumb twiddling while Windows XP boots and prompts you to log on.
Although you should expect to wait for a few moments, sometimes
Windows XP seems to boot rather slowly. In fact, you may notice that
over a period of time the PC that used to roar to life seems a bit
sluggish instead. Fortunately, you can perform several techniques that
help Windows XP get the bootup speed you want. This chapter explores
how to put these techniques to work.

Read all tips here
http://www.thinktarget.net/

This is not spam
--
http://www.thinktarget.net
http://www.thinktarget.net/Julia.htm
--


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Another Django Site with Source Code

2007-06-07 Thread hass

Thanks, looking at other code is always so helpful for me.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Users Portuguese

2007-06-07 Thread Nathaniel Whiteinge

Have you seen the existing `Django Brasil`__ group? It's got 165
members and seems pretty active.

.. __: http://groups.google.com/group/django-brasil


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: GenericRelation support in GeoDjango

2007-06-07 Thread Brian Luft

Russ and Justin

Thank you for your replies.  I had not tried the older syntax but I'm
glad to see it works.  I am generalizing an app I created that lets
one add location information to one's models and provides basic
facilities for regional and/or distance based searching.  Generic
relations is the icing on the cake since any arbitrary model in one's
app could then relate to my Location model without introducing any
coupling between the apps.  I'll wait for the dust to settle and
release to the community :)

Cheers
-Brian

On Jun 6, 7:52 pm, Justin Bronn <[EMAIL PROTECTED]> wrote:
> > I am wondering if it is known what needs to be done to bring the
> > contrib.contenttypes functionality up to date in the gis branch.
> > Specifically I'm looking for the generic relation support.
>
> I hadn't used or tried out generic relations until today, it's good
> stuff.
>
> The GIS branch is currently synced up with 0.96.  One month ago, in
> r5172, generic relations were moved to django.contrib.contenttypes
> since they depend on that.  This was a backwards incompatible change,
> as was noted by 
> Malcolm:http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Gener...
>
> When the GIS branch syncs back up to trunk, the syntax (as in the
> documentation) should be used.  However, use the old syntax until then
> -- I have confirmed it works.  For example, the following model uses a
> PointField for a generic relation:
>
> from django.contrib.gis.db import models
> from django.contrib.gis.geos import hex_to_wkt
> from django.contrib.contenttypes.models import ContentType
>
> class Point(models.Model, models.GeoMixin):
> point = models.PointField()
> content_type = models.ForeignKey(ContentType)
> object_id = models.PositiveIntegerField()
>
> objects = models.GeoManager()
>
> def __str__(self):
> return hex_to_wkt(self.point)
>
> class Animal(models.Model):
> name = models.CharField(maxlength=50)
> points = models.GenericRelation(Point)
>
> def __str__(self):
> return self.name
>
> class Person(models.Model):
> name = models.CharField(maxlength=50)
> points = models.GenericRelation(Point)
>
> def __str__(self):
> return self.name
>
> -Justin


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simple Template Dict Problem

2007-06-07 Thread Trey

Thanks Russ, I think my answer for today is three dimensional lists...
Hooray for complex datastructures :)

Tim, that's a very cool idea. I will research this some and see if I
can abstract the calendar control.

On Jun 7, 11:02 am, Tim Chase <[EMAIL PROTECTED]> wrote:
> > Somehow I doubt this should really be in the view either. Maybe it's
> > just one of those out liers that doesn't have a good place.
>
> Sounds like you're describing template tags.  They're ways of
> creating reusable bits you can just drop into your templates to
> abstract away the logic required to build them.
>
> http://www.djangoproject.com/documentation/templates_python/#writing-...
>
> particularly, the sections on simple tags and inclusion tags:
>
> http://www.djangoproject.com/documentation/templates_python/#shortcut...http://www.djangoproject.com/documentation/templates_python/#inclusio...
>
> You can just create a custom calendar control and then use that
> new tag in your HTML--much like one might drop a control in a GUI
> editor.
>
> -tim


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: best practice for portal-like pages?

2007-06-07 Thread patrick k.

did you take a look at the scripts I provided? it seems that this  
might solve your problem.

another thing: my question was not about doing a CMS, it´s about  
combining and displaying different types of content on portal-like  
pages (which, of course, might be part of a CMS). and it´s also not  
about "small company websites", but about bigger sites with lots of  
different content-types and at least a couple of different editors.

when reading reviews about django - esp. when django is compared with  
rails - it seems that django should suit these type of sites very  
well. and, as I´ve mentioned before, there _are_ a couple of bigger  
newspaper-sites out there. on the other hand, I haven´t seen a nice  
solution for this so far. I´m just wondering how people actually do  
these overview-sites (sorry, but I don´t have a better word for it ...).

thanks,
patrick


Am 07.06.2007 um 15:16 schrieb omat:

>
> I am also in need of such a flexible yet easy to manage content
> system, mostly for small company websites.
>
> In my primitive prototype, I have pages that are built-up of sections.
> Each section has its own template and can hold text, images, etc.
> Also, I am planning to add the ability to display data dynamically
> form another application.
>
> I am not willing to write the content administration part, but this
> flexibility makes it very hard to manage content using the built-in
> admin application. For example, a 50 page website with 10 sections per
> page on average shows up as a list of 500 sections, which is not very
> practical to manage.
>
> That's why I am not very satisfied with my application and would like
> to hear from others about this.
>
>
> There is nothing fancy about my model but just for reference, here it
> is:
>
>
> class SectionType(models.Model):
> name = models.CharField(maxlength = 50)
>
> def __str__(self):
> return self.name
>
> class Admin:
> pass
>
>
> class Section(models.Model):
> type = models.ForeignKey(SectionType)
> title = models.CharField(maxlength = 150,
>  blank = True)
> body = models.TextField(blank = True,
> null = True)
>
> def __str__(self):
> return '%s (%s)' % (self.title,
> self.type)
>
> class Admin:
> pass
>
>
> class SectionImage(models.Model):
> section = models.ForeignKey(Section,
> edit_inline = models.STACKED,
> null = True)
> image = models.ImageField(upload_to = 'section/image/')
>
> class Admin:
> pass
>
>
> class Page(models.Model):
> title = models.CharField(
>  maxlength = 100,
>  core = True,
>  db_index = True)
> slug = models.SlugField(prepopulate_from = ('title',))
> body = models.TextField(blank = True,
> null = True)
> sections = models.ManyToManyField(Section,
>   blank = True,
>   null = True)
>
> parent = models.ForeignKey('self',
>blank = True,
>null = True)
>
> order = models.PositiveSmallIntegerField(blank = True,
>  null = True)
>
> related_pages = models.ManyToManyField('self',
>blank = True,
>null = True)
>
> def __str__(self):
> parents = ''
> parent = self.parent
> while parent:
> parents = '%s :: %s' % (parent.title,
> parents,)
> parent = parent.parent
> return '%s%s (%s)' % (parents,
>   self.title,
>   self.slug)
>
> def get_absolute_url(self):
> return '%s/' % (self.slug)
>
> class Admin:
> pass
>
>
>
>
> On 7 Haziran, 10:39, "patrick k." <[EMAIL PROTECTED]> wrote:
>> this is just another request for feedback. I know that there are some
>> newspaper-sites out there, made with django. so, I assume, they´ve
>> solved this issue. It´d be great to know how they make/construct the
>> overview- resp. front-pages (in a way to make changes easily for
>> editors).
>>
>> thanks,
>> patrick
>>
>> Am 03.06.2007 um 19:28 schrieb oggie rob:
>>
>>
>>
>>> Ahh, yeah, I suppose so! I didn't really think the rendered text
>>> through, and you're right that it has the same flexibility.
>>
>>>  -rob
>>
>>> On Jun 3, 2:40 am, "patrick k." <[EMAIL PROTECTED]> wrote:
 actually, I don´t have to change the view for whatever layout I  
 want
 to have with my approach ...
>>
 patrick
>>
 Am 03.06.2007 um 00:40 schrieb oggie rob:
>>
> The advantage is you get to organize your additions in the base
> template 

Re: admin is inserting empty images

2007-06-07 Thread omat

Yes! It worked that way.

Thanks a lot...



On 7 Haziran, 18:09, robo <[EMAIL PROTECTED]> wrote:
> Have you tried moving core=True to the foreignkey field?
> Tell me if this works.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Do you know for a Free ...!? Click Here :)

2007-06-07 Thread only freewares

NoSpyMail 1.1
"SpyMail" refers to any email message sent to you which attempts to
collect information about you, your computer, or your email habits
without your permission. SpyMail is not a new concept. It has been
used by spammers for years to try to better target their Marketing
campaigns.
http://www.onlyfreeantivir.us/nospymail_1_1.php


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: admin is inserting empty images

2007-06-07 Thread robo

Have you tried moving core=True to the foreignkey field?
Tell me if this works.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Adding a group, and users to that group

2007-06-07 Thread Vincent Nijs

Thanks for the help Russ:

That worked. Next problem :) I want to add users to a group.

g = Group.objects.get(name='section81')

gives errors. 

If I could get that to work I'd want to add a user to that group:

u = User.objects.get(username='doe')

This also give errors.

Finally:

u.groups.add(g)

Which doesn't work because the previous 2 didn't :)

Sorry to ask multiple questions about this but I can't seem to find any
clear documentation on this.

Vincent

On 6/7/07 12:55 AM, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote:

> 
> On 6/7/07, Vincent Nijs <[EMAIL PROTECTED]> wrote:
>> 
>> TypeError: create() takes exactly 1 argument (2 given)
>> 
>> Any ideas?
> 
> Calling
> g = Group.objects.create("section81")
> 
> is the same as calling
> 
> Group("section81")
> 
> This yeilds an error because there is no way of knowing which model
> field the string "section81" should be applied to.
> 
> If you make this a keyword argument:
> 
> g = Group.objects.create(name="section81")
> 
> the problem should resolve itself.
> 
> Yours,
> Russ Magee %-)
> 
> > 

-- 
Vincent R. Nijs
Assistant Professor of Marketing
Kellogg School of Management, Northwestern University
2001 Sheridan Road, Evanston, IL 60208-2001
Phone: +1-847-491-4574 Fax: +1-847-491-2498
E-mail: [EMAIL PROTECTED]
Skype: vincentnijs




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simple Template Dict Problem

2007-06-07 Thread Tim Chase

> Somehow I doubt this should really be in the view either. Maybe it's
> just one of those out liers that doesn't have a good place.

Sounds like you're describing template tags.  They're ways of 
creating reusable bits you can just drop into your templates to 
abstract away the logic required to build them.

http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags

particularly, the sections on simple tags and inclusion tags:

http://www.djangoproject.com/documentation/templates_python/#shortcut-for-simple-tags
http://www.djangoproject.com/documentation/templates_python/#inclusion-tags

You can just create a custom calendar control and then use that 
new tag in your HTML--much like one might drop a control in a GUI 
editor.

-tim

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simple Template Dict Problem

2007-06-07 Thread Trey

I thought that something like that was the answer.

Normally I would agree but I can't think of another way to make a
calendar style layout with certain events on it. Check out my glorious
hack and tell me what you think.

c is a matrix from the calendar object.

import calendar

calendar.setfirstweekday(calendar.SUNDAY)
c = calendar.monthcalendar(2007, 6)


output = []
for w in c:
output.append('')
for d in w:
output.append('')
output.append('')
if d:
output.append(str(d))
else:
output.append('')
output.append('')
output.append('')
if d in attendance and attendance[d] > 0:
output.append(str(attendance[d]))
else:
output.append('')
output.append('')
output.append('')
output.append('')
output = ''.join(output)


Somehow I doubt this should really be in the view either. Maybe it's
just one of those out liers that doesn't have a good place.

On Jun 7, 10:38 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 6/7/07, Trey <[EMAIL PROTECTED]> wrote:
>
>
>
> > The first line, dict.1 works fine. But when I try to use the d
> > variable for the dict index it doesn't work. Is there a way to
> > accomplish this?
>
> No, by design. We have explicitly tried to avoid making the django
> template language a programming language.
>
> In the Django philosophy, it is the responsibility of the view author
> to extract and order data; the template is then responsible for
> displaying data, but not performing any calculations upon it. This is
> done to maintain a clear separation between logic and presentation.
>
> Indexing arrays by another variable is a very programmatic construct -
> hence its omission from the template language. If you feel the need to
> do this, you should probably be looking at why your template needs
> such complex logic, and why your view doesn't have that logic instead.
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simple Template Dict Problem

2007-06-07 Thread Russell Keith-Magee

On 6/7/07, Trey <[EMAIL PROTECTED]> wrote:
>
> The first line, dict.1 works fine. But when I try to use the d
> variable for the dict index it doesn't work. Is there a way to
> accomplish this?

No, by design. We have explicitly tried to avoid making the django
template language a programming language.

In the Django philosophy, it is the responsibility of the view author
to extract and order data; the template is then responsible for
displaying data, but not performing any calculations upon it. This is
done to maintain a clear separation between logic and presentation.

Indexing arrays by another variable is a very programmatic construct -
hence its omission from the template language. If you feel the need to
do this, you should probably be looking at why your template needs
such complex logic, and why your view doesn't have that logic instead.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Simple Template Dict Problem

2007-06-07 Thread Trey

That wasn't exactly the example as it was written. Let me try to
clarify.

w is simply a list of numbers.
w = [1,2,3,4,5,6,7,]

Take this dict.
dict = {1: 10, 2: 10, 19: 0, 29: 0, 30: 10}

{% for x in w %}
  {{dict.1}}
  {{dict.x}}
{% endfor %}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Taking a patch

2007-06-07 Thread Russell Keith-Magee

On 6/7/07, brian corrigan <[EMAIL PROTECTED]> wrote:
>
> Hey all,
>
> I am looking to take in the patches for ticket #399 (BigInt field). I
> am not sure how to do this though. There is an original patch.txt
> followed by a couple of .diff files. Are the .diff files the
> difference between the original source and the latest update to the
> patch or are they the .diff since the last patch?

Depends on who made the patch. However, generally speaking, each patch
will be self contained, unless otherwise noted in the ticket comments.

> Also the original patch is from 2 years ago and a lot has changed
> since then so I'm a little confused as to how I would go about taking
> in this patch.

Unless the area of code affected by the patch hasn't changed much
(which isn't very likely), the diff won't apply cleanly, so you'll
need to port the patch. Look at what code is being added by the patch,
try to find the analogous code in the current trunk, and manually
insert the code from the patch into your copy of the trunk code.

When you're done, don't forget to take a new diff and upload it to the
ticket so that others can share in your efforts.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Many to many in template question

2007-06-07 Thread Russell Keith-Magee

On 6/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> That's what I thought, too, but I can't seem to access it. Maybe I
> need to just write a custom view for this page.

Based on what you've said so far, you shouldn't need to write a new
view. You just need to reference the m2m data correctly. Assuming you
have the models:

class Foo(models.Model):
name = models.CharField()

class Bar(models.Model):
name = models.CharField()
foos =  models.ManyToManyField(Foo)

Then you can, in view code, ask for:
>>> Foo.objects.all()
>>> Bar.objects.all()
>>> mybar.foos.all()
>>> myfoo.bar_set.all()

And in template, if you have mybar and myfoo into the context, you can write:
{{ mybar }}
{{ myfoo }}
{% for foo in mybar.foos.all %}
{{ foo.name }}
{% endfor %}
{% for bar in myfoo.bar_set.all }
{{ bar.name }}
{% endfor %}

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Simple Concept and $4000 a week

2007-06-07 Thread [EMAIL PROTECTED]

MAKE $2000 - $4000 A WEEK WITH THIS SOFTWARE!
Stop worrying about money, this software swells up bank accounts.
http://www.leveragingonline.com
Quote of the Day
Live your life each day as you would climb a mountain. An occasional
glance towards the summit keeps the goal in mind
- Harold B. Melchart


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Many to many in template question

2007-06-07 Thread [EMAIL PROTECTED]

That's what I thought, too, but I can't seem to access it. Maybe I
need to just write a custom view for this page.

On Jun 6, 4:05 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> This doesn't exactly answer your question (because I'm a huge noob
> still), but M2M relationships work in both 
> directions:http://www.djangoproject.com/documentation/db-api/#many-to-many-relat...
>
> I think to access it in the template, you'd just need to pass the
> information from your view?
>
> On Jun 6, 1:42 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > I know I'm making this harder than it has to be, but the logic is just
> > escaping me.
>
> > I've got two models, say "Foo" and "Bar"
>
> > "Bar" establishes a manyToManyField relationship with "Foo":
> > foos =  models.ManyToManyField(Foo,
> > filter_interface=models.HORIZONTAL, null=True, blank=True)
>
> > I'm using a generic detail template for Foo, and want to include the
> > matching Bars.
> > Since Bar has the mtm and Foo doesn't, I figured Bar was aware of Foo,
> > but not the other way around, and therefore I would need a template
> > tag.
>
> > So assuming my logic so far is OK, how should I get the correct Bar
> > objects (the ones that have a matching Foo in foos)?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



a diff for the fastcgi server to make umask settable

2007-06-07 Thread Nic James Ferrier

flup provides the umask init field so that you can change the mask of
a unix socket you're using to talk fast cgi.

Django doesn't seem to pass this through so I wrote this trival patch.

Someone might be interested.

Apologies if this is not the right place.


-- 
Nic Ferrier
http://www.tapsellferrier.co.uk   


--- /usr/share/python-support/python-django/django/core/servers/fastcgi.py~
+++ /usr/share/python-support/python-django/django/core/servers/fastcgi.py
@@ -39,6 +39,7 @@
   daemonize=BOOL   whether to detach from terminal.
   pidfile=FILE write the spawned process-id to this file.
   workdir=DIRECTORYchange to this directory when daemonizing
+  umask=NUMBER set the umask used to create the socket
 
 Examples:
   Run a "standard" fastcgi process on a file-descriptor
@@ -69,8 +70,13 @@
 'minspare': 2,
 'maxchildren': 50,
 'maxrequests': 0,
+'umask': None,
 }
 
+# 'mode' added by nic on Thu Jun 7 13:25:07 BST 2007;
+# to communicate a mode for a unix socket to the flup fcgi backend
+
+
 def fastcgi_help(message=None):
 print FASTCGI_HELP
 if message:
@@ -127,6 +133,11 @@
 wsgi_opts['bindAddress'] = (options["host"], int(options["port"]))
 elif options["socket"] and not options["host"] and not options["port"]:
 wsgi_opts['bindAddress'] = options["socket"]
+if "umask" in options:
+try:
+wsgi_opts["umask"] = int(options["umask"])
+except ValueError:
+return fastcgi_help("If specified, umask should be an 
integer.")
 elif not options["socket"] and not options["host"] and not options["port"]:
 wsgi_opts['bindAddress'] = None
 else:



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: best practice for portal-like pages?

2007-06-07 Thread omat

I am also in need of such a flexible yet easy to manage content
system, mostly for small company websites.

In my primitive prototype, I have pages that are built-up of sections.
Each section has its own template and can hold text, images, etc.
Also, I am planning to add the ability to display data dynamically
form another application.

I am not willing to write the content administration part, but this
flexibility makes it very hard to manage content using the built-in
admin application. For example, a 50 page website with 10 sections per
page on average shows up as a list of 500 sections, which is not very
practical to manage.

That's why I am not very satisfied with my application and would like
to hear from others about this.


There is nothing fancy about my model but just for reference, here it
is:


class SectionType(models.Model):
name = models.CharField(maxlength = 50)

def __str__(self):
return self.name

class Admin:
pass


class Section(models.Model):
type = models.ForeignKey(SectionType)
title = models.CharField(maxlength = 150,
 blank = True)
body = models.TextField(blank = True,
null = True)

def __str__(self):
return '%s (%s)' % (self.title,
self.type)

class Admin:
pass


class SectionImage(models.Model):
section = models.ForeignKey(Section,
edit_inline = models.STACKED,
null = True)
image = models.ImageField(upload_to = 'section/image/')

class Admin:
pass


class Page(models.Model):
title = models.CharField(
 maxlength = 100,
 core = True,
 db_index = True)
slug = models.SlugField(prepopulate_from = ('title',))
body = models.TextField(blank = True,
null = True)
sections = models.ManyToManyField(Section,
  blank = True,
  null = True)

parent = models.ForeignKey('self',
   blank = True,
   null = True)

order = models.PositiveSmallIntegerField(blank = True,
 null = True)

related_pages = models.ManyToManyField('self',
   blank = True,
   null = True)

def __str__(self):
parents = ''
parent = self.parent
while parent:
parents = '%s :: %s' % (parent.title,
parents,)
parent = parent.parent
return '%s%s (%s)' % (parents,
  self.title,
  self.slug)

def get_absolute_url(self):
return '%s/' % (self.slug)

class Admin:
pass




On 7 Haziran, 10:39, "patrick k." <[EMAIL PROTECTED]> wrote:
> this is just another request for feedback. I know that there are some
> newspaper-sites out there, made with django. so, I assume, they´ve
> solved this issue. It´d be great to know how they make/construct the
> overview- resp. front-pages (in a way to make changes easily for
> editors).
>
> thanks,
> patrick
>
> Am 03.06.2007 um 19:28 schrieb oggie rob:
>
>
>
> > Ahh, yeah, I suppose so! I didn't really think the rendered text
> > through, and you're right that it has the same flexibility.
>
> >  -rob
>
> > On Jun 3, 2:40 am, "patrick k." <[EMAIL PROTECTED]> wrote:
> >> actually, I don´t have to change the view for whatever layout I want
> >> to have with my approach ...
>
> >> patrick
>
> >> Am 03.06.2007 um 00:40 schrieb oggie rob:
>
> >>> The advantage is you get to organize your additions in the base
> >>> template (which is where you should strive to manage layout & L as
> >>> much as possible). Your solution works fine for a row-by-row
> >>> example,
> >>> but is less flexible for a more complex layout. For example, if you
> >>> want to have a two- or three-column view, it is easier to manage
> >>> this
> >>> by changing it once in the base template than trying to tweak the
> >>> view
> >>> function. What's more, portals are often associated with "skins"
> >>> - it
> >>> would be much more flexible to have the choice of a few "base"
> >>> templates (representing different skins) with completely different
> >>> layouts for the "sub" templates. If you were looking for a generic
> >>> solution, I think you should consider that.
>
> >>> Not sure about how the "specific template" would fit in there
> >>> though... but I don't see major limitations with the approach I
> >>> described vs. your original proposal. In a case where you can't
> >>> generalize the view you probably want to save it as an html
> >>> snippet in
> >>> the database, I suppose.
>
> >>>  -rob
>
> >>> On Jun 2, 11:16 am, "patrick k." <[EMAIL PROTECTED]> 

translation datetime

2007-06-07 Thread Enquest

I see something that is not translated... Where can I finde the file...
And how do I submit this

In this case its

date:"P"

midnight = middernacht

in dutch




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: admin is inserting empty images

2007-06-07 Thread omat

Google ate my previous message. So, once again...

Thanks for the reply robo...

If I remove the "core=True" django complains that "there should be at
least one field declared as core to edit inline".

The problem is that, image and file fields does not behave as one
would expect in the admin when declared as "core". One solution is to
add a dummy field like "image_caption" and declare it as core, not the
image field itself. But this would introduce the overhead of giving
useless image captions for every image.


On 7 Haziran, 11:00, robo <[EMAIL PROTECTED]> wrote:
> Try removing the "core = True" in this line:
>
> image = models.ImageField(upload_to = 'section/image/',
>   core = True)
>
> I had a similar, if not exact, problem that I posted about a month and
> a half ago.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Taking a patch

2007-06-07 Thread brian corrigan

Hey all,

I am looking to take in the patches for ticket #399 (BigInt field). I
am not sure how to do this though. There is an original patch.txt
followed by a couple of .diff files. Are the .diff files the
difference between the original source and the latest update to the
patch or are they the .diff since the last patch?

Also the original patch is from 2 years ago and a lot has changed
since then so I'm a little confused as to how I would go about taking
in this patch.

All help is much appreciated,

Brian


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



newforms semicolon

2007-06-07 Thread Enquest

I wonder how I can remove the most easy way the semicolon in the newform
rendering...

Its very anoying that almost always this semicolon needs to be removed.
I don't think it should be programmed in the code ... 

However there should be an easy way to remove it.

Thanxs


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is composite primary key possible?

2007-06-07 Thread Lars Stavholm

Russell Keith-Magee wrote:
> On 6/7/07, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> And then I hit a snag: there's one table that uses a composite
>> primary key made up of three fields. (the attachment table in trac.db)
>>
>> I've scanned the doco and I've googled, this is what I came up with:
>>
>> o define one of the fields as a primary
>> o add the unique_together Meta constraint
>>
>> Is there another/better way?
> 
> Unfortunately, no. That's about the best you can do at the moment.

OK.

> Composite primary keys are a frequently requested feature, but there
> is one major problem - specifying a URL for an object with a composite
> key in the Admin application (or any other application for that
> matter).
> 
> Suggestions are welcome, but search the archives first, beacuse this
> isn't the first time it has been suggested, and there are problems
> with many of the obvious ideas.

I can see the difficulties.

Thanks
/Lars

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: form_for_model, custom save(), and saving excluded fields?

2007-06-07 Thread John M

I had a similar issue, and after lurking around a bit, banging the
head on the table, etc, I figured out I could make a form, set the
fields to non-editable, use the form.save(commit=False) option, and do
exactly what I needed.

I was creating a form for a child model,and wanted to fill in the
relationship (parent) field/ID myself.

Heres a sample of what I did on an update routine (handles adds and
edits in same code):

def update1(request, portid, holdid=None):

objportfolio = Portfolio.objects.get(pk=portid)

if holdid is None:
# Add function
modelform = form_for_model(Holding, form=HoldingForm)
form = modelform()
else:
instance = Holding.objects.get(id__exact=holdid)
modelform = form_for_instance(instance, form=HoldingForm)
form = modelform(instance.__dict__)

if request.POST:
form = modelform(request.POST)
if form.is_valid():
obj = form.save(commit=False)
obj.portfolio = objportfolio
obj.save()
return HttpResponseRedirect('/holding')

return render_to_response('holding/update.html', {'form': form} )

Hope this helps.

John


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: admin is inserting empty images

2007-06-07 Thread robo

Try removing the "core = True" in this line:

image = models.ImageField(upload_to = 'section/image/',
  core = True)

I had a similar, if not exact, problem that I posted about a month and
a half ago.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Login Right After Creating a New User

2007-06-07 Thread [EMAIL PROTECTED]

On Jun 6, 10:04 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:

> Yes. The 'backend' attribute that is being complained about is an
> attribute that is decorated onto the user object by the authenticate()
> method (django.contrib.auth.authenticate()). If you call authenticate,
> providing the login credentials, you will get a 'decorated' user that
> can then be used in the login method.
>
> Yours,
> Russ Magee

Thanks a lot! Worked like a charm.

- Cristian


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



admin is inserting empty images

2007-06-07 Thread omat

I have the following model which defines a 1-n relation between
sections and section images:

class Section(models.Model):
type = models.ForeignKey(SectionType)
title = models.CharField(maxlength = 150,
 blank = True)
class Admin:
pass

class SectionImage(models.Model):
section = models.ForeignKey(Section,
edit_inline = models.STACKED,
null = True)
image = models.ImageField(upload_to = 'section/image/',
  core = True)
class Admin:
pass


When I add / edit a section, admin app displays 3 file form fields for
uploading images (as they are edited inline), and when I save the
section, an empty string is saved into the db for every empty image
form field.

Is there something wrong with my model, or is this a bug in admin?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: best practice for portal-like pages?

2007-06-07 Thread patrick k.

this is just another request for feedback. I know that there are some  
newspaper-sites out there, made with django. so, I assume, they´ve  
solved this issue. It´d be great to know how they make/construct the  
overview- resp. front-pages (in a way to make changes easily for  
editors).

thanks,
patrick

Am 03.06.2007 um 19:28 schrieb oggie rob:

>
> Ahh, yeah, I suppose so! I didn't really think the rendered text
> through, and you're right that it has the same flexibility.
>
>  -rob
>
> On Jun 3, 2:40 am, "patrick k." <[EMAIL PROTECTED]> wrote:
>> actually, I don´t have to change the view for whatever layout I want
>> to have with my approach ...
>>
>> patrick
>>
>> Am 03.06.2007 um 00:40 schrieb oggie rob:
>>
>>
>>
>>> The advantage is you get to organize your additions in the base
>>> template (which is where you should strive to manage layout & L as
>>> much as possible). Your solution works fine for a row-by-row  
>>> example,
>>> but is less flexible for a more complex layout. For example, if you
>>> want to have a two- or three-column view, it is easier to manage  
>>> this
>>> by changing it once in the base template than trying to tweak the  
>>> view
>>> function. What's more, portals are often associated with "skins"  
>>> - it
>>> would be much more flexible to have the choice of a few "base"
>>> templates (representing different skins) with completely different
>>> layouts for the "sub" templates. If you were looking for a generic
>>> solution, I think you should consider that.
>>
>>> Not sure about how the "specific template" would fit in there
>>> though... but I don't see major limitations with the approach I
>>> described vs. your original proposal. In a case where you can't
>>> generalize the view you probably want to save it as an html  
>>> snippet in
>>> the database, I suppose.
>>
>>>  -rob
>>
>>> On Jun 2, 11:16 am, "patrick k." <[EMAIL PROTECTED]> wrote:
 what´s the advantage of including the sub-templates in the template
 instead of rendering them in the view?
 rendering the templates in the view seems to be a bit more flexible
 when it comes to caching, I guess.
>>
 besides, a custom entry could have its own specific template -  
 so, I
 ´m not sure how you´d deal with this.
>>
 thanks,
 patrick
>>
 Am 02.06.2007 um 20:07 schrieb oggie rob:
>>
> Using the "include" tag, you can provide the template through a
> variable
> e.g. {% include template1 %} instead of {% include 'mysite/
> movies.html' %}
> so you can pass this stuff from the view.
> What's more, the include template uses the context from the  
> "parent"
> template. So you can also pass all this information from the view.
> For example, your view could work as follows (code is littered  
> with
> mistakes but you should get the idea):
> def my_portal(request, user_id):
> template_list = get_portal_template_list(user_id) # returns  
> list
> of strings, representing template names
> data = {'templates':template_list}
> for template in template_list:
> data.update(get_template_data(template, user_id))
> render_to_response(data, "base_template.html")
>>
> in base_template.html
> {% for item in template_list %}
> {% include item %}
> {% endfor %}
>>
> You may also organize & test a little more using the "with" tag  
> (it
> appears to works alongside "include"). e.g (with a modified view):
> {% for item in template_list %}
>{% with item.data as data %}
>  {% include item.template %}
>{% endwith %}
> {% endfor %}
>>
> then in the included template:
> {{ data.field1 }}
> {{ data.field2 }}
>>
> HTH,
>  -rob
>>
> On Jun 2, 4:51 am, patrickk <[EMAIL PROTECTED]> wrote:
>> This is a problem we´re having with every webpage we did with
>> django
>> so far.
>> Now, I´d like to make this more generic and write a tutorial for
>> how
>> a portal-like page could be done using django.
>>
>> As an example, let´s say we have a database with movies, stars
>> (actors, writers, directors ...), cinemas/theatres, interviews,
>> image-
>> galleries, trailers, filmfestivals, ...
>> Now, the editors should be able to "build" a page (e.g. the  
>> front-
>> page) with different blocks of content like:
>> 1. a single object (e.g. a movie, star, interview ...)
>> 2. combined objects: a combination of x objects (e.g. "godard-
>> special" with a relation to a star (godard), a cinema where the
>> special takes place and several movies)
>> 3. pre-defined blocks (like "recent comments", "recent  
>> interviews",
>> "most discussed movies" ...)
>> 4. custom entries
>>
>> ### 1 and 4 is easy: for 1, we can use a generic foreign key.
>> for 4,
>> we´re using a second table ("custom entries") and also a generic
>> foreign key - so 1 

Re: if 'photo' in request.FILES seems to be not working

2007-06-07 Thread Dushyant Sharma

i can not beleive this i had only to write enctype in capital
ENCTYPE="multipart/form-data"
i am sick


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to execute an external application from View

2007-06-07 Thread nagi

hi folks,
One of my view's function execute an external application and should
return the status of this application's process. This view function
should not wait the application end, just execute and return a page
that shows application's process. The application sends its status to
file and the status page should read it frequently. I made
os.spawnv(os.P_NOWAIT, ext.app...) to execute external application but
the view function waits until this application to end. If application
takes long time, user waits until it ends.
Any help would be appreciated.

Thanks in advance

Nagi


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Deployment Headache (Apache Permissions?)

2007-06-07 Thread Dushyant Sharma

i am having the same problem i tried  adding mysite.pth to site-
packages folder
now i can see the path in python as
/root/workspace/
and
/root/workspace/mysite

settings.py is in  mysite directory at /root/workspace also i have
__init_.py there
it show the same error
but if i put the directory mysite at site-packages it works just fine




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newforms: Override FileField save method

2007-06-07 Thread Russell Keith-Magee

On 6/7/07, grahamu <[EMAIL PROTECTED]> wrote:
>
> Russ,
> Perhaps you are correct. I am using 5335 patched with #3297, but guess
> I just don't know how to code (or name?) the necessary method.

You shouldn't need to code or name anything. When you save the form,
the file should be saved into the named upload directory.

> Problems I have are threefold:
> 1. With either type of save I cannot seem to override the 'upload_to'
> location string before the file contents are saved.

This can't be done with the #3297 patch. It's arguable whether it is a
good idea at all. It certainly isn't a form issue - it's a model
issue.

The difficulty with changing the location is determining where to look
for the file later. Your best bet would be to subclass
models.FileField to provide an alternate implementation for
get_directory_name().

> 2. If a file with the same name already exists in the appropriate
> 'upload_to' location, I want to delete that file prior to saving the
> new file.

You need to call x.delete_input_file_file()
(where x is an instance of ToolRun)

> 3. I really don't want the 'upload_to' path prepended to the filename
> stored in 'input_file' in the ToolRun instance.

Again, this isn't a form issue - it's the behaviour of Django model
fields. See previous comments on subclassing models.FileField

> This has no effect on where the uploaded files are stored. I

No. There isn't any magic connecting the stored name of the file and
the file itself. If you change the stored name of the file, the actual
file won't be moved.

> def save_input_file_file(filename, raw_contents):
> # save it in the correct subdir
> 
>
> According to the debugger, this function is never called.

No, it won't be. Your provided definition will be overwritten by the
version of the method installed by the model metaclass.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---