Re: displaying thumbnails in admin

2006-12-06 Thread Kamil Wdowicz
the worst idea is: class Picture(models.Model): file = models.ImageField(upload_to=settings.MY_MEDIA, blank=True, null=True) entry = models.ForeignKey(Entry) def filename(self): if os.name == 'nt': return

Re: implementing user themes using Django templates

2006-12-06 Thread Calvin
Rohit wrote: > I am using Django templates standalone for rendering an > Apache/modpython website (without Django apps). I need to provide > themes for each user: they will have the ability to choose from a set > of themes and when that changes the base template directory needs to > change *for

Admin fields for contained members

2006-12-06 Thread JMCameron
>From tutorial, part 2, the following type of code class Poll(models.Model): ... class Admin: fields = ( ) is used to control how the admin interface displays the Poll objects (controlling which items appear on separate lines, etc). How can I control how the contained

Re: limit_choices_to and negative logic in Q objects?

2006-12-06 Thread Darin Lee
Well, I figured this part out at least... QNot(Q(field__filter='some value')) Next Question. Is there a way to reference 'self.id' inside the model class, to exclude the current self from the select list? In my case, I have a self-referencing table of parents and children. I want to

Re: limit_choices_to and negative logic in Q objects?

2006-12-06 Thread Jeremy Dunck
On 12/6/06, Darin Lee <[EMAIL PROTECTED]> wrote: > Does anyone have > any pointers on how to make this work? from django.core.meta import Q, QNot q=QNot(Q(whatever__exact=1)) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

limit_choices_to and negative logic in Q objects?

2006-12-06 Thread Darin Lee
Hi, I'm trying to figure out how to use inverted/NOT logic in the limit_choices_to argument for models.ForeignKey() fields. A google search turned up the following: http://code.djangoproject.com/ticket/1579 This tracker comment indicates that this issue was/is resolved by adding support

Re: Anonymous Sessions

2006-12-06 Thread [EMAIL PROTECTED]
Hrm if that's the case, I msut have slipped up in the code somewhere. Thanks :) I'll go see if i am inserting into sessions for some reason if they're anonymous. On Dec 6, 4:27 pm, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > It is a problem. It hits the db if it has

Re: test client - Keeps returning 301 status code and not sure why.

2006-12-06 Thread Russell Keith-Magee
On 12/7/06, MerMer <[EMAIL PROTECTED]> wrote: > > I am trying to get to grips with the test client > (Django.test.client.Client) > > I've done the following > > >>from Djano.test.client import Client > >>c=Client() > >>c=c.get('/promotions/',) > >>c.status_code > 301 301 is a permanent

test client - Keeps returning 301 status code and not sure why.

2006-12-06 Thread MerMer
I am trying to get to grips with the test client (Django.test.client.Client) I've done the following >>from Djano.test.client import Client >>c=Client() >>c=c.get('/promotions/',) >>c.status_code 301 I keep getting 301 or 500 status codes. I've tried the full URL but have not got any further.

Re: Random Data

2006-12-06 Thread alex kessinger
I have can generate random data like Alan Boyce suggested, and that works to a point but as my models evolved I am looking for a more general way of generate random data so that I don't have to mess with the random generation section every time I change a model. I am asking because I am still

Re: Random Data

2006-12-06 Thread [EMAIL PROTECTED]
You can use python. Try: # Make a random phone number def mkphone(): import random phone = "" for i in range(10): if (i == 3): phone += "-" if (i == 6): phone += "-" phone += str(random.randrange(0,9)) return phone # Based on

Re: Fast fcgi on dreamhost --> shauwn of the dead, help me shoot zombies

2006-12-06 Thread coulix
I did the rename trick, still screw today. I will change my hosting pay a little bite more for a virtual server and set up apache + mod_python. i should have done this since the begining. On Dec 5, 2:38 am, "Phil" <[EMAIL PROTECTED]> wrote: > I stumbled across your post via jeffcrot.com and

Re: Random Data

2006-12-06 Thread Rock
I wrote a utility to parse a model files as well as embedded comments that provided data loading hints. It was trivial to do. The utility used "cog" to generate a data loading program. That worked like a charm even as the underlying models evolved. (This approach was a "win" since the data

Re: Read only fields once created

2006-12-06 Thread MerMer
You can add "editable=False" to you database model. This prevents it from showing up in Admin, though of course it can still be edited directly in the DB. MerMer Ross Burton wrote: > Hi, > > Is it possible to have fields in the model that can be set at object > creation, but are immutable

Re: OpenID

2006-12-06 Thread MerMer
There was a very recent post on CAS (Central Authentication System). The author has written the middeware for Django and is making it publically available. I've no idea if there are any differences between CAS and OpenID, but thought it might be worth a mention. MerMer

Random Data

2006-12-06 Thread [EMAIL PROTECTED]
I was wondering if anybody has any ideas on random generation of data. I want to fill some of my models with random data with random users and such. So that I can see how my UI is doing and some other tests. I figured that becuase there is alot of data defenition in the models there is probably

Re: Admin 404s on users

2006-12-06 Thread [EMAIL PROTECTED]
Also, I commented out all apps in settings.py except the "default" django ones, and it still happened. Anyone got any more ideas? I kind of need user admin! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: Multiprocessing and Django

2006-12-06 Thread Jacob Kaplan-Moss
On 12/6/06 12:00 PM, garyrob wrote: > Due to Python's global interpreter lock, I assume that Django can't > take advantage of multiple CPU's. Is that correct? But most high-end > machines these days come with multiple CPU's. No, that's not correct; if you're running Django in an approved

Multiprocessing and Django

2006-12-06 Thread garyrob
My company is buying a new machine to run a Django-based application. Due to Python's global interpreter lock, I assume that Django can't take advantage of multiple CPU's. Is that correct? But most high-end machines these days come with multiple CPU's. If so, is there any reason we can't

Re: Outputting comma separated list for objects in a ForeignKey?

2006-12-06 Thread [EMAIL PROTECTED]
Brilliant, thanks! --~--~-~--~~~---~--~~ 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

displaying thumbnails in admin

2006-12-06 Thread [EMAIL PROTECTED]
Hi -- how can I make the admin interface display images? The default is to show the link to an image. I know it should be easy but I'm not sure how to go about doing it. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Outputting comma separated list for objects in a ForeignKey?

2006-12-06 Thread Jacob Kaplan-Moss
On 12/6/06 1:48 PM, [EMAIL PROTECTED] wrote: > I have a model, which has ForeignKey relationship to another model set > up. How can I output a list of all the objects within the ForeignKey as > a comma separated list? > > For example - the list has 3 objects (a, b, c) - so should output a > list

Re: Read only fields once created

2006-12-06 Thread Sarcastic Zombie
On Dec 6, 2:48 pm, "Sarcastic Zombie" <[EMAIL PROTECTED]> wrote: > On Dec 5, 3:24 am, "Ross Burton" <[EMAIL PROTECTED]> wrote: > > > Hi, > > > Is it possible to have fields in the model that can be set at object > > creation, but are immutable after that? I have an "original estimate" > >

Re: Read only fields once created

2006-12-06 Thread Sarcastic Zombie
On Dec 5, 3:24 am, "Ross Burton" <[EMAIL PROTECTED]> wrote: > Hi, > > Is it possible to have fields in the model that can be set at object > creation, but are immutable after that? I have an "original estimate" > field that should only be set when creating the object, and never > edited after

Outputting comma separated list for objects in a ForeignKey?

2006-12-06 Thread [EMAIL PROTECTED]
Hey, I have a model, which has ForeignKey relationship to another model set up. How can I output a list of all the objects within the ForeignKey as a comma separated list? For example - the list has 3 objects (a, b, c) - so should output a list like "a, b, c" How can I do this (in the

Re: problems turning debug off

2006-12-06 Thread Noah
Flat pages catches a 404 and then looks to see if a flat page exists for that url --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Converting a Django site to flat HTML

2006-12-06 Thread Rob Hudson
Here's the wget flags I'm using to do something similar: wget -E --load-cookies /path/to/firefox/profiles/cookies.txt -r -k -l inf -N -p -E = use .html as extension -r = recurse -k = convert links -l inf = infinite depth -N = disable timestamping? -p = get page requisites Other than that, I

AttributeError: 'NoneType' object has no attribute 'split'

2006-12-06 Thread Jeremy Dunck
Forwarded from the Django dev list in the hopes that future searchers find this... The python2.4 email module has a bug which affects Django upload handling for multipart forms (e.g. forms w/ file uploads). -- Forwarded message -- From: Jeremy Dunck <[EMAIL PROTECTED]> Date: Dec

Re: Best way to administer static configuration data?

2006-12-06 Thread spacedman
Ah, and you also have to override the .delete() method! http://groups.google.com/group/django-developers/browse_frm/thread/2caa976249783fae/# --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Best way to administer static configuration data?

2006-12-06 Thread spacedman
[EMAIL PROTECTED] wrote: > I could create a model and then only have one row, but that seems > clunky. I did exactly this and overrode the .save() method so that the model was constrained to only have one row by resetting self.id to 1 in the .save() (I think...). Effect was that if you added

Re: Anonymous Sessions

2006-12-06 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > It is a problem. It hits the db if it has to create it. Sorry I still don't understand :-). You say that you do need authentication but don't need anonymous sessions. Then in default Django setup you never hit a database unless you try to store something in session.

Re: Best way to administer static configuration data?

2006-12-06 Thread Jacob Kaplan-Moss
On 12/6/06 9:04 AM, [EMAIL PROTECTED] wrote: > I'm looking to manage site configuration data through an administrative > interface, such as changing the header graphic of my site. In my > pre-Django days I would have loaded a text configuration file's > contents into form fields, and the save

Best way to administer static configuration data?

2006-12-06 Thread [EMAIL PROTECTED]
I'm looking to manage site configuration data through an administrative interface, such as changing the header graphic of my site. In my pre-Django days I would have loaded a text configuration file's contents into form fields, and the save would overwrite it. I could create a model and then

Re: Anonymous Sessions

2006-12-06 Thread [EMAIL PROTECTED]
It is a problem. It hits the db if it has to create it. If i have to I'll rewrite the library. On Dec 6, 12:31 pm, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Well we obviously need authentication, we just don't need anonymous > > session handling.Then it shouldn't be

Re: GenericForeignKey

2006-12-06 Thread Jacob Kaplan-Moss
On 12/6/06 6:32 AM, paulh wrote: > Using a GenericForeignKey everything seems to work until you try to use > fields in an Admin class. That's right - generic relations don't (yet) have the necessary code for admin interfaces. It'll happen eventually, but for now, sorry! Jacob

Re: Converting a Django site to flat HTML

2006-12-06 Thread James Mulholland
Hi, yes I looked at Curl but I was looking for a quick 'n' dirty way to do it, without worrying too much about the options on the command line. Since I'm coming to Python from Perl, I would also probably choose a Perl-ish way to do what you're accomplishing with Python modules. But, whatever :)

GenericForeignKey

2006-12-06 Thread paulh
Using a GenericForeignKey everything seems to work until you try to use fields in an Admin class. The you get an error like this: FieldDoesNotExist at /modp/admin/tst2/comnam/add/ Comnam has no field named 'com_obj' and a python dump. Just updated by copy of django with the latest dev version and

Re: High Load

2006-12-06 Thread Uros Trebec
[EMAIL PROTECTED] je napisal: > We may test postgreSQL to see if this fixes our latest problem, as our > SQL cluster isnt setup yet as the hoster didnt have it ready, and this > is a peak traffic day. That might be a good idea. It seams that PgSQL scales 200% percent better than MySQL (when

Re: Anonymous Sessions

2006-12-06 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > Well we obviously need authentication, we just don't need anonymous > session handling. Then it shouldn't be a problem. Sessions are created and hit db only if you store something in it. Or if you have SESSION_SAVE_EVERY_REQUEST = True. Otherwise request.session is

Re: Anonymous Sessions

2006-12-06 Thread [EMAIL PROTECTED]
Well we obviously need authentication, we just don't need anonymous session handling. On Dec 6, 11:31 am, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I'd like a simple option to disable this, any plans to implement > > something of the sorts?The intended way is to

Re: Anonymous Sessions

2006-12-06 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > I'd like a simple option to disable this, any plans to implement > something of the sorts? The intended way is to remove SessionMiddleware and those depending on it (AuthenticationMiddleware) from MIDDLEWARE_CLASSES and 'django.contrib.sessions',

can't figure out how to call a generic view inside my own view

2006-12-06 Thread Anton Daneika
Hello, everyone. I am trying to call django.views.generic.list_detail.object_list from my own view, but I get the error page saying "dict' object has no attribute '_clone'" Here is the function: def my_gallery_listing(request, gallery_id): d = dict(queryset=Photo.objects.filter(gallery__pk =

implementing user themes using Django templates

2006-12-06 Thread Rohit
I am using Django templates standalone for rendering an Apache/modpython website (without Django apps). I need to provide themes for each user: they will have the ability to choose from a set of themes and when that changes the base template directory needs to change *for that user only*. For