how to handle django static files(css js etc) properly.the views.static.serve or apache's SetHandler None just too eerie
I recently deployed my dear Django on winows + apache +mod_python.. following DjangoBook step by step everything is fine but one thing the static file(css particularly) . I need press F5 constantly to refresh my no-bug page to get the css file down to show that page properly. I tried views.static.serve failed. tried separate a virual-host to serve the static file sololy failed and completely out of any clue. I'm a new comer to django hope you offer some 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: Access ManyToMany objects
> Question: In python, how do I access name attribute in Author? That > is, I'd like to know how to find out author of each entry.? Hi Nick, The relevant documentation is here: http://www.djangoproject.com/documentation/db-api/#related-objects Basically, since entries have a many-to-many relationship to authors, you'll be able to access those authors via 'entry.author_set.all()', where entry is any given Entry. For each resulting author, you can get its related user as author.name. It can make for some awkward python in the views, since author_set returns a list (even if there's only one), and if you want to do anything with the authors you need to iterate over the list or slice it or something else. Worth noting: 'name' is a confusing designation for a related field. You'd expect 'name' to return a string value, not be a foreign key. It's a small issue, but fixing it will make coding easier down the line. Hope that helps, Eric --~--~-~--~~~---~--~~ 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: Striped tables in Django
Look up the "cycle" template tag. It will do exactly what you want. --~--~-~--~~~---~--~~ 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: Sending SMS messages
On Jan 23, 2008 5:01 PM, John <[EMAIL PROTECTED]> wrote: > > Let me try and answer your questions. > > Do you need to receive SMS? If you need to receive SMS, you will need > to host your own GSM device or modem so that people can send you SMS. afaik clickatell can receive sms messages on your behalf and trigger some sort of callback to your server. not sure how it works though. > If not, you can just use internet SMS gateways like clickatell to do > the work, and post to them by HTTP, XML or email. The cost is about > 6-8 cents per SMS. There are cheaper services, but not always > reliable. If you need to host your own GSM device, you can use > software like [url]http://www.kannel.org[/url] (GPL Open Source) or > [url]http://www.visualgsm.com[/url]. can you share some other service names, not necessarily cheaper but with a decent api like clickatell has? thx papa --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Access ManyToMany objects
New to django and python. Just trying some basics here.I have the following model: class Author(models.Model): name = models.ForeignKey(User) def __str__(self): return self.name.username class Entry(models.Model): body_text = models.TextField() headtitle = models.CharField(maxlength=152) pubdate = models.DateTimeField() authors = models.ManyToManyField(Author) I have these populated in MySql (5 entries with 3 different authors, populated via Django admin) Question: In python, how do I access name attribute in Author? That is, I'd like to know how to find out author of each entry.? Please help. Thanx --~--~-~--~~~---~--~~ 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: Multiple form objects, only getting contents from last one
On Jan 22, 5:22 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > What level of Django are you running? I recall seeing reports of behavior > like this, but it has been fixed. See for example: > > http://code.djangoproject.com/ticket/5665 Hm. It's 0.96, but I haven't tried it on a newer version just yet. I suppose I'll have to give that a go, but was hoping to stick to stable releases if possible. Thanks! 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: Sending SMS messages
Let me try and answer your questions. Do you need to receive SMS? If you need to receive SMS, you will need to host your own GSM device or modem so that people can send you SMS. If not, you can just use internet SMS gateways like clickatell to do the work, and post to them by HTTP, XML or email. The cost is about 6-8 cents per SMS. There are cheaper services, but not always reliable. If you need to host your own GSM device, you can use software like [url]http://www.kannel.org[/url] (GPL Open Source) or [url]http://www.visualgsm.com[/url]. Regards, SMS Gateway Expert http://www.visualtron.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: Striped tables in Django
On Jan 23, 2008 4:55 PM, shabda <[EMAIL PROTECTED]> wrote: > > Does anybody have a code snippet for getting striped tables with > django? Basically I would need to apply alternating classes to the the > rows returned by the rowset. I do not want to do this from javascript, > but from server side. http://www.djangoproject.com/documentation/templates/#cycle papa --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Striped tables in Django
Does anybody have a code snippet for getting striped tables with django? Basically I would need to apply alternating classes to the the rows returned by the rowset. I do not want to do this from javascript, but from server side. --~--~-~--~~~---~--~~ 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: (Conceptual?) problem w/login_required
On Jan 22, 2008 10:16 PM, Jason Witherspoon <[EMAIL PROTECTED]> wrote: > Hi folks-- > > I've got the following code in a view: > > from django.shortcuts import get_object_or_404, render_to_response > from django.http import HttpResponseRedirect > from django.core.urlresolvers import reverse > from mysite.officemeetingpoll.models import Meetingtime > from django.contrib.auth.decorators import login_required > from django.contrib.auth import authenticate, login > from django.newforms import form_for_instance > > @login_required > def vote(request): >m = Meetingtime.objects.get(user=request.user) >UserForm = form_for_instance(m) >f = UserForm(auto_id=False) >return render_to_response('officemeetingpoll/form.html', > {'form':f}) > > I'm hoping this will check if the user is logged in, go to the default > login page & redirect back if not, & then render an edit form for the > office meeting poll. > > Here's the model: > > from django.db import models > from django.contrib.auth.models import User > > class Meetingtime(models.Model): >time = models.CharField(max_length=40) >user = models.ManyToManyField(User, blank=True, null=True) >CONVENIENCE_CHOICES = ( >('A', 'I can make this time regularly'), >('S', 'I could occasionally make this time'), >('N', 'I could rarely if ever make this time'), >) >convenience = models.CharField(max_length=1, > choices=CONVENIENCE_CHOICES) >unique_together = (("user", "time"),) >def __unicode__(self): >return self.time >class Admin: >list_display = ('time', 'convenience') >fields = ( >(None, {'fields': ('time', 'convenience', > 'user')}), >) > > > > However, it doesn't send me to the login page, it generates the > following error: > > > DoesNotExist at /officepoll/officepolls/ > Meetingtime matching query does not exist. > Request Method: GET > Request URL:http://www.rainbow.coop/officepoll/officepolls/ > Exception Type: DoesNotExist > Exception Value:Meetingtime matching query does not exist. > Exception Location: /usr/local/lib/python2.5/site-packages/django/db/ > models/query.py in get, line 263 > Python Executable: /usr/local/bin/python > Python Version: 2.5.1 > Python Path:['/home/jason/killdjangokill', '/usr/local/lib/python2.5/ > [snipped] > > ...which is no surprise, since the view is relying upon the logged-in > user info, & I'm not getting redirected to the login page, so there's > no user info to match. > > Now, this is my first run at this, & frankly (& obviously, no doubt) > I'm more than a bit baffled by the whole sessions framework business. > Am I anywhere in the ballpark? Any advice much appreciated! > Are you sure you are not logged in? If you assign a local variable to the value of request.user before trying the get then when you get the debug page you can see the user value among the local variables. If it's a django.contrib.auth.models.AnonymousUser, then somehow you got past the @login_required without logging in. I think it's more likely you are logged in and no Meetingtime matching your user exists. (Also, are you sure you want a get there? Using get implies there will be exactly one Meetingtime per user, otherwise the get will raise an exception.) Karen --~--~-~--~~~---~--~~ 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: empty PATH_INFO with LiteSpeed / FastCGI
well, one way to do this is through a middleware class, like this: class SetEmptyPathInfo(object): def process_request(self, request): if not request.path: request.META['PATH_INFO'] = '/' request.path = '/' seems to be working for now. On Jan 22, 9:45 am, Dan Conner <[EMAIL PROTECTED]> wrote: > I have been setting up a site with LiteSpeed serving Django. the > basics work, but I end up with an error when requestinghttp://mysite.com/. > > TypeError at 'NoneType' object is not iterable at django/django/core/ > handlers/base.py in get_response, line 73. > > It seems very related to the ticket > 3414,http://code.djangoproject.com/ticket/3414. > the second patch on that ticket fixes the problem. > > setting APPEND_SLASH does not affect it at all. > > I'd like to find a way to set environ['PATH_INFO'] without changing > code in the django trunk and wondering if there would be a way in the > code that is executed by LiteSpeed. Right now, it's using manage.py > runfcgi daemonize=false method=threaded. > > The examples on this > page:http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango, > include some code that deals with the issue, but I can't quite see how > to use that method with LiteSpeed, or lighttpd. > > Thanks for any input or direction on how to approach this, > dc --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
(Conceptual?) problem w/login_required
Hi folks-- I've got the following code in a view: from django.shortcuts import get_object_or_404, render_to_response from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from mysite.officemeetingpoll.models import Meetingtime from django.contrib.auth.decorators import login_required from django.contrib.auth import authenticate, login from django.newforms import form_for_instance @login_required def vote(request): m = Meetingtime.objects.get(user=request.user) UserForm = form_for_instance(m) f = UserForm(auto_id=False) return render_to_response('officemeetingpoll/form.html', {'form':f}) I'm hoping this will check if the user is logged in, go to the default login page & redirect back if not, & then render an edit form for the office meeting poll. Here's the model: from django.db import models from django.contrib.auth.models import User class Meetingtime(models.Model): time = models.CharField(max_length=40) user = models.ManyToManyField(User, blank=True, null=True) CONVENIENCE_CHOICES = ( ('A', 'I can make this time regularly'), ('S', 'I could occasionally make this time'), ('N', 'I could rarely if ever make this time'), ) convenience = models.CharField(max_length=1, choices=CONVENIENCE_CHOICES) unique_together = (("user", "time"),) def __unicode__(self): return self.time class Admin: list_display = ('time', 'convenience') fields = ( (None, {'fields': ('time', 'convenience', 'user')}), ) However, it doesn't send me to the login page, it generates the following error: DoesNotExist at /officepoll/officepolls/ Meetingtime matching query does not exist. Request Method: GET Request URL:http://www.rainbow.coop/officepoll/officepolls/ Exception Type: DoesNotExist Exception Value:Meetingtime matching query does not exist. Exception Location: /usr/local/lib/python2.5/site-packages/django/db/ models/query.py in get, line 263 Python Executable: /usr/local/bin/python Python Version: 2.5.1 Python Path:['/home/jason/killdjangokill', '/usr/local/lib/python2.5/ site-packages/TurboGears-1.0.3.2-py2.5.egg', '/usr/local/lib/python2.5/ site-packages/SQLObject-0.9.1-py2.5.egg', '/usr/local/lib/python2.5/ site-packages/Cheetah-2.0rc8-py2.5-linux-i686.egg', '/usr/local/lib/ python2.5/site-packages/configobj-4.4.0-py2.5.egg', '/usr/local/lib/ python2.5/site-packages/DecoratorTools-1.5-py2.5.egg', '/usr/local/lib/ python2.5/site-packages/RuleDispatch-0.5a0.dev_r2306-py2.5-linux- i686.egg', '/usr/local/lib/python2.5/site-packages/FormEncode-0.7.1- py2.5.egg', '/usr/local/lib/python2.5/site-packages/ elementtree-1.2.7_20070827_preview-py2.5.egg', '/usr/local/lib/ python2.5/site-packages/simplejson-1.7.1-py2.5.egg', '/usr/local/lib/ python2.5/site-packages/CherryPy-2.2.1-py2.5.egg', '/usr/local/lib/ python2.5/site-packages/TurboKid-1.0.2-py2.5.egg', '/usr/local/lib/ python2.5/site-packages/TurboCheetah-0.9.5-py2.5.egg', '/usr/local/lib/ python2.5/site-packages/TurboJson-1.1-py2.5.egg', '/usr/local/lib/ python2.5/site-packages/PyProtocols-1.0a0dev_r2302-py2.5-linux- i686.egg', '/usr/local/lib/python2.5/site-packages/PasteDeploy-1.3.1- py2.5.egg', '/usr/local/lib/python2.5/site-packages/Paste-1.4- py2.5.egg', '/usr/local/lib/python2.5/site-packages/kid-0.9.6- py2.5.egg', '/usr/local/lib/python2.5/site-packages/docutils-0.4- py2.5.egg', '/usr/local/lib/python2.5/site-packages/setuptools-0.6c7- py2.5.egg', '/usr/local/lib/python2.5/site-packages/ SQLAlchemy-0.4.0beta7dev_r3551-py2.5.egg', '/usr/local/lib/python2.5/ site-packages/Pylons-0.9.6.1-py2.5.egg', '/usr/local/lib/python2.5/ site-packages/Mako-0.1.8-py2.5.egg', '/usr/local/lib/python2.5/site- packages/nose-0.10.0-py2.5.egg', '/usr/local/lib/python2.5/site- packages/decorator-2.2.0-py2.5.egg', '/usr/local/lib/python2.5/site- packages/PasteScript-1.3.6-py2.5.egg', '/usr/local/lib/python2.5/site- packages/Beaker-0.7.5-py2.5.egg', '/usr/local/lib/python2.5/site- packages/WebHelpers-0.3.2-py2.5.egg', '/usr/local/lib/python2.5/site- packages/Routes-1.7.1-py2.5.egg', '/usr/local/lib/python2.5/site- packages/Myghty-1.1-py2.5.egg', '/usr/local/lib/python25.zip', '/usr/ local/lib/python2.5', '/usr/local/lib/python2.5/plat-linux2', '/usr/ local/lib/python2.5/lib-tk', '/usr/local/lib/python2.5/lib-dynload', '/ usr/local/lib/python2.5/site-packages', '/usr/local/lib/python2.5/site- packages/killdjangokill', '/usr/local/lib/python2.5/site-packages/ mysite'] ...which is no surprise, since the view is relying upon the logged-in user info, & I'm not getting redirected to the login page, so there's no user info to match. Now, this is my first run at this, & frankly (& obviously, no doubt) I'm more than a bit baffled by the
Form adding new datum instead of updating existing datum
I've created a form that allows a user to edit a datum in a model. However, when a user performs an edit, django adds that value as a new datum rather than editing the existing datum in the database. Any idea what's wrong? #Model # class Recipe(models.Model): recipe_name = models.CharField(max_length=100, verbose_name='Recipe Name') ingrediants = models.TextField(blank=True, verbose_name='Ingrediants') instructions = models.TextField(blank=True, verbose_name='Instructions') external_url = models.URLField(blank=True, verbose_name='External URL') cuisine = models.ForeignKey(Cuisine) course = models.ForeignKey(Course) image = models.ImageField(blank=True, upload_to='img2/') thumbnail = models.ImageField(blank=True, upload_to='img/thumbs/') one_liner = models.CharField(max_length=100, blank=True, verbose_name='Comments') tag_list = models.ManyToManyField(Tag, blank=True, verbose_name='Tags') user = models.ForeignKey(User) def __unicode__(self): return self.recipe_name class Admin: pass #ModelForm class RecipeForm(ModelForm): class Meta: model = Recipe exclude = ('user','thumbnail','tag_list') # View that creates form def testForm(request, recipe_id): r = Recipe.objects.get(pk=recipe_id) f = RecipeForm(instance=r) return render_to_response('chef/test-form.html', {'form':f}) # View that processes form ## def editConfirm(request): f = RecipeForm(request.POST, request.FILES) if not f.errors: modified_recipe = f.save(commit=False) modified_recipe.user = User.objects.get(id=1) #placeholder until I add users; necessary for FK relation modified_recipe.save() return render_to_response('chef/edit-confirm.html', {'recipe': modified_recipe}) else: msg = 'Form not valid' return render_to_response('chef/error.html', {'msg':msg}) # Template w/Form ## Add New Recipe {{ form.as_table }} Thanks all! ~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: "unexpected indent" error not allowing me to add the poll app to the admin site
Hello, Regarding tabs... quoting http://www.python.org/dev/peps/pep-0008/ Tabs or Spaces? Never mix tabs and spaces. The most popular way of indenting Python is with spaces only. The second-most popular way is with tabs only. Code indented with a mixture of tabs and spaces should be converted to using spaces exclusively. When invoking the Python command line interpreter with the -t option, it issues warnings about code that illegally mixes tabs and spaces. When using -tt these warnings become errors. These options are highly recommended! For new projects, spaces-only are strongly recommended over tabs. Most editors have features that make this easy to do. ==End quote== Jeff Anderson almostvindiesel wrote: Is it possible to change the python interpreter to treat a single tab character the same as 4 space characters (rather than 8)? On Jan 6, 7:40 pm, Darryl Ross <[EMAIL PROTECTED]> wrote: >> I was having problems with my text editor. For some reason Python >> didn't like the way it handled tabs/spaces. I stopped using tabs and >> started using spaces, and that seemed to fix the problem. Your solution of using spaces instead of tabs to indent worked perfectly! The python interpreter will treat a single tab character the same as 8 space characters, so if you indent using 4 spaces then a tab is the same as two indents. Regards Darryl signature.asc 1KDownload --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- signature.asc Description: OpenPGP digital signature
Re: "unexpected indent" error not allowing me to add the poll app to the admin site
Is it possible to change the python interpreter to treat a single tab character the same as 4 space characters (rather than 8)? On Jan 6, 7:40 pm, Darryl Ross <[EMAIL PROTECTED]> wrote: > >> I was having problems with my text editor. For some reason Python > >> didn't like the way it handled tabs/spaces. I stopped using tabs and > >> started using spaces, and that seemed to fix the problem. > > > Your solution of using spaces instead of tabs to indent worked > > perfectly! > > The python interpreter will treat a single tab character the same as 8 > space characters, so if you indent using 4 spaces then a tab is the same > as two indents. > > Regards > Darryl > > signature.asc > 1KDownload --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
DjangoAMF deployment problems
We are having problems deploying a Flex+DjangoAMF+Django app on an apache server. The result event coming back from DjangoAMF indicates success, yet contains no data. Wondering if you encountered any of this with your django musings. --~--~-~--~~~---~--~~ 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 transaction system
On Jan 22, 5:41 pm, Jonathan Ballet <[EMAIL PROTECTED]> wrote: > Le Tue, 22 Jan 2008 14:18:53 -0800 (PST), Rajesh Dhawan > <[EMAIL PROTECTED]> a écrit : > > > - Before you execute lines of code that need to be synchronized > > between processes, read mylock from memcached and set it to the > > current timestamp if it's null. > > ... and bam, another process access the lock when it was still null, > and both processes set it to a timestamp :) As you noticed below, memcached supports the "add" operator that sets a value only if the key has no existing value. So, with a little refinement that could be incorporated into the flow: when the key is set (i.e. added), the caller would recheck that the addition was successful with another get before proceeding. The value used could be a tuple of (timestamp, some-random-long-id). That way the caller can check that the add() was successful. > > I don't really know memcached, but maybe it's API provide some > way to avoid race conditions (maybe the 'add' function [1] from the > memcached API). > > [1] see "What about race conditions?" inhttp://www.danga.com/memcached/ As I also noted previously, this approach is a rudimentary synchronization technique. It's not fool proof by any means. If more reliable atomicity is critical even if performance suffers a bit, one could cook up a REST web service to manage a central lock where the semaphore is a lock on a physical file. Then, all Django processes would call this REST service to acquire a lock. The service could even do all the waiting and would only return when it can deliver a lock. -Rajesh D --~--~-~--~~~---~--~~ 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 transaction system
YES There was a problem with atomic operations. But the add from memcached looks to be atomic: "adds to the cache, only if it doesn't already exist". P1 and P2 both try to add "thisModelInstance_lock", only one will make it. Busy loop (or sleep for a minimal amount of time), trying to add it. Whichever can add the value first continues onto the code and removes it from the cache so the other can proceed. I'm going to try to make this. If it works, it should be a pretty clean inter-process & inter-server mutex that is fast and doesn't require disk access. Thanks! Ivan On Jan 22, 2:41 pm, Jonathan Ballet <[EMAIL PROTECTED]> wrote: > Le Tue, 22 Jan 2008 14:18:53 -0800 (PST), Rajesh Dhawan > <[EMAIL PROTECTED]> a écrit : > > > - Before you execute lines of code that need to be synchronized > > between processes, read mylock from memcached and set it to the > > current timestamp if it's null. > > ... and bam, another process access the lock when it was still null, > and both processes set it to a timestamp :) > > I don't really know memcached, but maybe it's API provide some > way to avoid race conditions (maybe the 'add' function [1] from the > memcached API). > > [1] see "What about race conditions?" inhttp://www.danga.com/memcached/ --~--~-~--~~~---~--~~ 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: Multiple form objects, only getting contents from last one
On Jan 22, 2008 5:54 PM, Tim <[EMAIL PROTECTED]> wrote: > > > > On Jan 22, 3:45pm, Chris Brand <[EMAIL PROTECTED]> wrote: > > I'd start by looking at the HTML that results, particularly the "input > name" parts. From your symptoms, it sounds like you may have two (or more) > with the same name. > > > > Chris > > Thanks, Chris. > > Here's some example output. As you can see, the prefix-adding part of > the code does what it'ssupposed to, in that each input line for the > answers is uniquely marked. The problem I've got is the set of answers > provided per question, as they should be different from one question > to the next. > > [snipped] What level of Django are you running? I recall seeing reports of behavior like this, but it has been fixed. See for example: http://code.djangoproject.com/ticket/5665 Karen --~--~-~--~~~---~--~~ 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: Loading fixtures from views
On Jan 23, 2008 6:39 AM, Ariel Mauricio Nunez Gomez <[EMAIL PROTECTED]> wrote: > Russ, > > Thanks for the solution you suggested, I am about to implement it, but > something came to my mind: how would I know if the fixture loading was > successful or failed? I know it writes to the standard error output the > result if I set verbosity higher, but it would be nicer if an exception was > raised. In that case, you probably want to use the serializer directly. The 'loaddata' command is a pretty simple 'find file and load fixture' wrapper around the core serialization services. The serialization docs, plus the implementation of loaddata (django/core/management/commands/loaddata.py) should give you an idea of what is required. It would be possible to refactor the loaddata command to provide an exception-throwing fixture load service; feel free to have a go at refactoring this code if you want. 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: Multiple form objects, only getting contents from last one
Ugh... sorry about the formatting, BTW. I'll have to figure that 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: Multiple form objects, only getting contents from last one
On Jan 22, 3:45 pm, Chris Brand <[EMAIL PROTECTED]> wrote: > I'd start by looking at the HTML that results, particularly the "input name" > parts. From your symptoms, it sounds like you may have two (or more) with the > same name. > > Chris Thanks, Chris. Here's some example output. As you can see, the prefix-adding part of the code does what it'ssupposed to, in that each input line for the answers is uniquely marked. The problem I've got is the set of answers provided per question, as they should be different from one question to the next. - Tim Survey Display Stop! Who approacheth the Bridge of Death must answer me these questions three, ere the other side he see. What is your quest? Answers: Red! Purple! What is your favourite colour? Answers: Red! Purple! --~--~-~--~~~---~--~~ 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: Template Macros Like In Jinja
On Jan 23, 2008 11:32 AM, James Bennett <[EMAIL PROTECTED]> wrote: > > On Jan 22, 2008 4:15 PM, Papalagi Pakeha <[EMAIL PROTECTED]> wrote: > > what's the reasoning behind not having and not planning to have macros > > in django templates? they look like a very useful construct compliant > > with DRY to me. > > Django's template system is meant to be a means of expressing > presentation, not a programming language. Programmable macros are, > well, part of a programming language, not a presentation system. template macros are not that much about programming. it's about bringing DRY to templates since without macros you often have to repeat the same HTML again and again. i'm indeed biased as in my last project we used TAL template engine which has a decent support for macros (but many serious problems in other areas hence i'm not keen to drop the native django template engine in favour of TAL. yet). i'll explore jinja a bit more. that could be the way to go. papa --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[solution] Re: Template Macros Like In Jinja
Hi Papa > i wonder if there is any way to have Macros in django templates > similar to what Jinja has (http://jinja.pocoo.org/)? Have a look at "Support for {% macro %} tags in templates" at http://www.djangosnippets.org/snippets/363/ I bet it's exactly what you're after. It lets you define macros with {%macro%} tag and use it with {%usemacro%}, you can load macros from external file with {%loadmacros%}, etc. Hope that helps Michal --~--~-~--~~~---~--~~ 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: Template Macros Like In Jinja
On Jan 22, 2008 5:15 PM, Papalagi Pakeha <[EMAIL PROTECTED]> wrote: > > On Jan 23, 2008 4:08 AM, James Bennett <[EMAIL PROTECTED]> wrote: > > > > On Jan 21, 2008 8:30 PM, Papalagi Pakeha <[EMAIL PROTECTED]> > wrote: > > > i wonder if there is any way to have Macros in django templates > > > similar to what Jinja has (http://jinja.pocoo.org/)? > > > > No. > > > > The Jinja project was started specifically to add additional > > programming constructs that the Django template system does not and > > likely will not implement. > > what's the reasoning behind not having and not planning to have macros > in django templates? they look like a very useful construct compliant > with DRY to me. > Check out the Philosophy box here: http://www.djangoproject.com/documentation/templates/ Also the introductory information here: http://www.djangobook.com/en/1.0/chapter04/ provides the gist of the reasoning. Net is template designers shouldn't have to be able to understand programming, and any real programming-type things you want to do in a template are probably better done in the view or a custom template tag/filter. It's not a philosophy everyone agrees with (Jinja creators, for example, feel this is unnecessarily constraining on template designers), but it is one that the Django devs try to stick to pretty consistently. Karen --~--~-~--~~~---~--~~ 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 transaction system
Le Tue, 22 Jan 2008 14:18:53 -0800 (PST), Rajesh Dhawan <[EMAIL PROTECTED]> a écrit : > - Before you execute lines of code that need to be synchronized > between processes, read mylock from memcached and set it to the > current timestamp if it's null. ... and bam, another process access the lock when it was still null, and both processes set it to a timestamp :) I don't really know memcached, but maybe it's API provide some way to avoid race conditions (maybe the 'add' function [1] from the memcached API). [1] see "What about race conditions?" in http://www.danga.com/memcached/ --~--~-~--~~~---~--~~ 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: Cannot catch _mysql_exceptions.OperationalError
Karen - I agree - this was very strange - that's why I was confused. I've not yet upgraded to 0.96.1, so I guess that's the next step. Thanks, Bob On Jan 18, 1:01 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Jan 18, 2008 10:51 AM, Robert Swerdlow <[EMAIL PROTECTED]> wrote: > > > > > I posted this note at comp.lang.python and the response there was that > > this all works outside of Django. What is the problem with using MySQL > > OperationalErrors with Django? > > > - > > In our database code (we are using django v0.96) we wanted to catch > > and handle MySQL OperationalErrors. We use both the Django models and > > database connections. > > > However, even though we confirmed that a > > _mysql_exceptions.OperationalError are raised (particularly 1213 > > deadlock), we cannot catch them with try/except. > > > Here's the code that did not work: > > > import _mysql_exceptions > > from _mysql_exceptions import OperationalError > > > try: > > database_code() > > except (_mysql_exceptions.OperationalError, OperationalError), e: > > error_handling() > > > Originally, we just had one import, but tried both to ensure that was > > not the problem. In debugging, we confirmed that both type(e) and > > e.__class_ were . > > > The only work-around we found was: > > > try: > > database_code() > > except Exception, e: > > if e.__class__.__name__.find('OperationalError') != -1: > > error_handling() > > else: > > raise > > > This seems silly. If we used any other exception, the except clause > > seems to work correctly. > > > Is there a problem with _mysql_exceptions.OperationalError? Is there > > a better work-around? > > --- > > I cannot recreate any problem with catching OperationalErrors using Django > 0.96.1. To test I added a field to a model definition that doesn't exist in > the database and tried a get -- this generates an OperationalError, which I > was able to catch: > > Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] > on win32 > Type "help", "copyright", "credits" or "license" for more information. > (InteractiveConsole)>>> from mini.models import Authors > >>> import _mysql_exceptions > >>> def tryget(): > > ... try: > ... a = Authors.objects.get(pk=22) > ... except _mysql_exceptions.OperationalError, e: > ... print 'get failed with OperationalError: ' + str(e) > ... return > ... print 'get succeeded, a = ' + str(a) > ...>>> tryget() > > get failed with OperationalError: (1054, "Unknown column 'mini_authors.Xtra' > in 'field list'")>>> import django > >>> django.VERSION > > (0, 96.094, None) > > > > My MySQLdb is version 1.2.2. > > I don't know why a 1213 OperationalError would be treated any differently > than the 1054 one above. > > It sounds very odd to me that you verified the class of the exception you > catch with 'catch Exception, e' is _mysql_exceptions.OperationalError> but you cannot 'catch > _mysql_exceptions.OperationalError'. > Sorry, but I have no explanation for how that could happenall I can say > is catching OperationalErrors when running Django code works for me. > > Karen --~--~-~--~~~---~--~~ 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: Template Macros Like In Jinja
On Jan 22, 2008 4:15 PM, Papalagi Pakeha <[EMAIL PROTECTED]> wrote: > what's the reasoning behind not having and not planning to have macros > in django templates? they look like a very useful construct compliant > with DRY to me. Django's template system is meant to be a means of expressing presentation, not a programming language. Programmable macros are, well, part of a programming language, not a presentation system. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 transaction system
> Also, the cases are much more complicated than val+=1. They are > multiple lines of python operations on models. > I just used that as an example to illustrate the problem. > > A lock is the real solution, but I have no idea how to implement it > properly. If you go with the memcached idea I proposed above, you don't even need to manage multiple locks per row of data. That will keep things simple enough for you to have a first shot at implementing this. So, let's say you have one "global" lock i.e. key in memcached called mylock. Your multi-process synchronization would go like this: - Before you execute lines of code that need to be synchronized between processes, read mylock from memcached and set it to the current timestamp if it's null. In other words, acquire a lock. On the other hand, if mylock is not null, it means another synchronized block has claimed a lock. So, check periodically in a loop for that lock to get released back to null before this process proceeds. - Execute your synchronized lines of code including any model.save calls so that your work gets back to the DB. Do a transaction commit if you are manually managing your transactions. - Clear mylock from memcached. The advantage of putting a timestamp as the value of mylock is that you can detect stale locks i.e. the process that put in the lock died before releasing the lock. If you know that no lock should stay for more than 30 seconds, you will be in a position to automatically clear out stale locks. Of course, this is a very rudimentary locking pattern. It doesn't take into account any kind of queuing of pending requests for the lock. But it might be sufficient. If you get this to work, you could then consider a per instance key such as mylock- where is the model's PK. -Rajesh D --~--~-~--~~~---~--~~ 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: Template Macros Like In Jinja
On Jan 23, 2008 4:08 AM, James Bennett <[EMAIL PROTECTED]> wrote: > > On Jan 21, 2008 8:30 PM, Papalagi Pakeha <[EMAIL PROTECTED]> wrote: > > i wonder if there is any way to have Macros in django templates > > similar to what Jinja has (http://jinja.pocoo.org/)? > > No. > > The Jinja project was started specifically to add additional > programming constructs that the Django template system does not and > likely will not implement. what's the reasoning behind not having and not planning to have macros in django templates? they look like a very useful construct compliant with DRY to me. papa --~--~-~--~~~---~--~~ 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 transaction system
Sorry, this code is supposed to be while ModelLock.objects.filter(name=name).filter(isLocked=True).count()>0: pass lock = ModelLock.objects.filter(name=name)[0] lock.isLocked=True lock.save() On Jan 22, 1:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > Or you could possibly have a lock management table/model in your database. > > I had that idea. > > I could have: > class ModelLock(models.Model): > name = models.CharField(max_length=100) > isLocked = models.BooleanField() > > This is an ok solution -- pretty much the only one i have. But there > is a HUGE problem with this. > > Here is how the locking might work (assuming for each row i'd like to > lock, there is a ModelLock) > > while ModelLock.objects.filter(name=name).filter(isLocked=True): > pass > lock = ModelLock.objects.filter(name=name)[0] > lock.isLocked=True > lock.save() > > The huge problem: ModelLock is not a proper mutex. The calls to > isLocked=True & save() are NOT atomic. > > I've heard about inter-process mutexes, but that wouldn't even solve > the problem you bring up of requests on different servers. > > A memcached lock would probably be better because at least setting the > lock would be faster than setting it in a database table. > > Ivan > > On Jan 22, 12:27 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > Let's say I have a model with an integer value. I'd like to increment > > > that value. > > > > Multiple processes would like to increment that value. > > > > Does the transaction middleware properly protect against this? > > > > Example: > > > Processes P1, P2, model instance m, with m.val > > > > - P1 grabs the object : m = MyModel.objects.filter(get the m i want) > > > [0] > > > - P2 grabs the object : m = MyModel.objects.filter(get the m i want) > > > [0] > > > - P1 m.val += 1 > > > - P2 m.val += 1 > > > - P1 m.save() > > > - P2 m.save() > > > > What happens normally? What happens with the transaction middleware? > > > The transaction middleware can't do anything special in these > > situations. The instances of 'm' in processes P1 and P2 are two > > separate Python object instances. If P2's m.save() gets called after > > P1's m.save(), then m.val from P2's instance will get saved in the > > database regardless of the m.val set by P1. The two instances are not > > connected to each other. > > > > What happens if the view is more complicated and only conditionally > > > accesses certain models. Will all models actually accessed be properly > > > locked? > > > No. The model instances are not locked like this at all. > > > You will need a global shared memory/storage area to simulate an > > interprocess lock of your own. Realize that your processes could even > > be on different web servers. For example, you could use a "slot" in > > memcache to acquire and release a custom lock every time around the > > statements where you increment m.val. Or you could possibly have a > > lock management table/model in your database. > > > -Rajesh D --~--~-~--~~~---~--~~ 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: InnoDB on?
Thanks! This worked great: mysql> SHOW ENGINES\G here are the results for a default installation on OS X Leopard and Ubuntu 7.10 server. Both use MyISAM === OS X Server version: 5.0.45 MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> SHOW ENGINES\G *** 1. row *** Engine: MyISAM Support: DEFAULT Comment: Default engine as of MySQL 3.23 with great performance *** 2. row *** Engine: MEMORY Support: YES Comment: Hash based, stored in memory, useful for temporary tables *** 3. row *** Engine: InnoDB Support: YES Comment: Supports transactions, row-level locking, and foreign keys *** 4. row *** Engine: BerkeleyDB Support: NO Comment: Supports transactions and page-level locking *** 5. row *** Engine: BLACKHOLE Support: YES Comment: /dev/null storage engine (anything you write to it disappears) *** 6. row *** Engine: EXAMPLE Support: YES Comment: Example storage engine *** 7. row *** Engine: ARCHIVE Support: YES Comment: Archive storage engine *** 8. row *** Engine: CSV Support: YES Comment: CSV storage engine *** 9. row *** Engine: ndbcluster Support: DISABLED Comment: Clustered, fault-tolerant, memory-based tables *** 10. row *** Engine: FEDERATED Support: YES Comment: Federated MySQL storage engine *** 11. row *** Engine: MRG_MYISAM Support: YES Comment: Collection of identical MyISAM tables *** 12. row *** Engine: ISAM Support: NO Comment: Obsolete storage engine 12 rows in set (0.00 sec) === UBUNTU 7.10 === Server version: 5.0.45-Debian_1ubuntu3.1-log Debian etch distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> SHOW ENGINES\G *** 1. row *** Engine: MyISAM Support: DEFAULT Comment: Default engine as of MySQL 3.23 with great performance *** 2. row *** Engine: MEMORY Support: YES Comment: Hash based, stored in memory, useful for temporary tables *** 3. row *** Engine: InnoDB Support: YES Comment: Supports transactions, row-level locking, and foreign keys *** 4. row *** Engine: BerkeleyDB Support: NO Comment: Supports transactions and page-level locking *** 5. row *** Engine: BLACKHOLE Support: YES Comment: /dev/null storage engine (anything you write to it disappears) *** 6. row *** Engine: EXAMPLE Support: NO Comment: Example storage engine *** 7. row *** Engine: ARCHIVE Support: YES Comment: Archive storage engine *** 8. row *** Engine: CSV Support: YES Comment: CSV storage engine *** 9. row *** Engine: ndbcluster Support: DISABLED Comment: Clustered, fault-tolerant, memory-based tables *** 10. row *** Engine: FEDERATED Support: YES Comment: Federated MySQL storage engine *** 11. row *** Engine: MRG_MYISAM Support: YES Comment: Collection of identical MyISAM tables *** 12. row *** Engine: ISAM Support: NO Comment: Obsolete storage engine 12 rows in set (0.00 sec) On Jan 22, 1:12 pm, Jonathan Ballet <[EMAIL PROTECTED]> wrote: > Hi, > > Le Tue, 22 Jan 2008 11:08:41 -0800 (PST), "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> a écrit : > > > > > I need InnoDB for MySQL to do row locking in hopes of this working > > efficiently. > > > Is InnoDB on by default in MySQL 5.0? > > > How can I tell? > > Look at the "SHOW ENGINES" SQL > queryhttp://dev.mysql.com/doc/refman/5.0/en/show-engines.html > > - Jonathan --~--~-~--~~~---~--~~ 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 transaction system
> But, I guess you can add a method (or override the save() method maybe), to > send the correct SQL query. Writing my own SQL for each time I'd like to maintain data integrity is something I'm not really interested in. I'm using Django to avoid writing SQL. Also, the cases are much more complicated than val+=1. They are multiple lines of python operations on models. I just used that as an example to illustrate the problem. A lock is the real solution, but I have no idea how to implement it properly. Ivan On Jan 22, 1:07 pm, Jonathan Ballet <[EMAIL PROTECTED]> wrote: > Hi, > > Le Tue, 22 Jan 2008 11:07:45 -0800 (PST), "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> a écrit : > > > Example: > > Processes P1, P2, model instance m, with m.val > > > - P1 grabs the object : m = MyModel.objects.filter(get the m i want) > > [0] > > - P2 grabs the object : m = MyModel.objects.filter(get the m i want) > > [0] > > - P1 m.val += 1 > > - P2 m.val += 1 > > - P1 m.save() > > - P2 m.save() > > > What happens normally? What happens with the transaction middleware? > > I guess the save() methods will set directly the new value, instead of > sending a "val + 1" UPDATE to the database. > > So, if m.val == 0 when you load the object in both P1 and P2, it will > result in : > > UPDATE mymodel SET val = 1 WHERE id = ? > > whereas you want : > > UPDATE mymodel SET val = val + 1 WHERE id = ? > > In the latter, the transaction will handle this (well, as Jeff Anderson > said, the _database_ will handle this), and your "val" field will be +2. > > However, I'm pretty sure Django will do the former. It needs to be > checked. > But, I guess you can add a method (or override the save() method > maybe), to send the correct SQL query. > > - Jonathan --~--~-~--~~~---~--~~ 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 transaction system
> Or you could possibly have a lock management table/model in your database. I had that idea. I could have: class ModelLock(models.Model): name = models.CharField(max_length=100) isLocked = models.BooleanField() This is an ok solution -- pretty much the only one i have. But there is a HUGE problem with this. Here is how the locking might work (assuming for each row i'd like to lock, there is a ModelLock) while ModelLock.objects.filter(name=name).filter(isLocked=True): pass lock = ModelLock.objects.filter(name=name)[0] lock.isLocked=True lock.save() The huge problem: ModelLock is not a proper mutex. The calls to isLocked=True & save() are NOT atomic. I've heard about inter-process mutexes, but that wouldn't even solve the problem you bring up of requests on different servers. A memcached lock would probably be better because at least setting the lock would be faster than setting it in a database table. Ivan On Jan 22, 12:27 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > Hi, > > > > > Let's say I have a model with an integer value. I'd like to increment > > that value. > > > Multiple processes would like to increment that value. > > > Does the transaction middleware properly protect against this? > > > Example: > > Processes P1, P2, model instance m, with m.val > > > - P1 grabs the object : m = MyModel.objects.filter(get the m i want) > > [0] > > - P2 grabs the object : m = MyModel.objects.filter(get the m i want) > > [0] > > - P1 m.val += 1 > > - P2 m.val += 1 > > - P1 m.save() > > - P2 m.save() > > > What happens normally? What happens with the transaction middleware? > > The transaction middleware can't do anything special in these > situations. The instances of 'm' in processes P1 and P2 are two > separate Python object instances. If P2's m.save() gets called after > P1's m.save(), then m.val from P2's instance will get saved in the > database regardless of the m.val set by P1. The two instances are not > connected to each other. > > > > > What happens if the view is more complicated and only conditionally > > accesses certain models. Will all models actually accessed be properly > > locked? > > No. The model instances are not locked like this at all. > > You will need a global shared memory/storage area to simulate an > interprocess lock of your own. Realize that your processes could even > be on different web servers. For example, you could use a "slot" in > memcache to acquire and release a custom lock every time around the > statements where you increment m.val. Or you could possibly have a > lock management table/model in your database. > > -Rajesh D --~--~-~--~~~---~--~~ 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: Multiple form objects, only getting contents from last one
I'd start by looking at the HTML that results, particularly the "input name" parts. From your symptoms, it sounds like you may have two (or more) with the same name. Chris > -Original Message- > From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] > On Behalf Of Tim > Sent: 22 January 2008 1:30 PM > To: Django users > Subject: Multiple form objects, only getting contents from last one > > > Hello, > > I am working on a small app, based on Malcolm Tredinnick's "complex > forms" article, located at http://www.pointy- > stick.com/blog/2008/01/06/django-tip-complex-forms/. > > I have a few quiz questions, where each displays its available > answers. The end result is that there are multiple Django (new) forms > within one HTML form object, as intended. However, the answers for > each quiz question are getting set to those for the last question in > the list, as shown below: > > What is your quest? > > Answers: > Red! > Purple! > > What is your favourite colour? > > Answers: > Red! > Purple! > > > If there is one question, the answers match up, but otherwise they're > wrong for all but the last one. My own version (his is below) just > adds a bunch of debug print statements. What I think is happening > though, is that the answers coming from the database are correct, but > the part where the fields are set appears to reference answers as a > class variable. Does this sound correct? From debug output, the > self.fields value starts off pretty much empty, then is updated OK the > first time. For the second question, the self.fields still has the > contents from the first question, until it updates it. Shouldn't this > be a separate variable instance per question? > > Suggestions are welcome. > > Thanks, > Tim > > (code follows) > > > > """ > Create the quiz form(s). > """ > > from django import newforms as forms > from django.http import Http404 > > from models import Question > > class QuestionForm(forms.Form): > answers = forms.ChoiceField(widget=forms.RadioSelect()) > > def __init__(self, question, *args, **kwargs): > super(QuestionForm, self).__init__(*args, **kwargs) > self.problem = question.problem > answers = question.answers.order_by('statement') > self.fields['answers'].choices = [(i, a.statement) for i, a in > enumerate(answers)] > > # We need to work out the position of the correct answer in > the sorted > # list of all possible answers. > for pos, answer in enumerate(answers): > if answer.id == question.correct_answer_id: > self.correct = pos > break > > def is_correct(self): > """ > Determines if the given answer is correct (for a bound form). > """ > if not self.is_valid(): > return False > return self.cleaned_data['answers'] == str(self.correct) > > def create_quiz_forms(quiz_id, data=None): > questions = > Question.objects.filter(quiz__pk=quiz_id).order_by('id') > form_list = [] > for pos, question in enumerate(questions): > form_list.append(QuestionForm(question, data, prefix=pos)) > if not form_list: > # No questions found, so the quiz_id must have been bad. > raise Http404('Invalid quiz id.') > return form_list > > > --~--~-~--~~~---~--~~ 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: Loading fixtures from views
Russ, Thanks for the solution you suggested, I am about to implement it, but something came to my mind: how would I know if the fixture loading was successful or failed? I know it writes to the standard error output the result if I set verbosity higher, but it would be nicer if an exception was raised. Ariel. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Multiple form objects, only getting contents from last one
Hello, I am working on a small app, based on Malcolm Tredinnick's "complex forms" article, located at http://www.pointy-stick.com/blog/2008/01/06/django-tip-complex-forms/. I have a few quiz questions, where each displays its available answers. The end result is that there are multiple Django (new) forms within one HTML form object, as intended. However, the answers for each quiz question are getting set to those for the last question in the list, as shown below: What is your quest? Answers: Red! Purple! What is your favourite colour? Answers: Red! Purple! If there is one question, the answers match up, but otherwise they're wrong for all but the last one. My own version (his is below) just adds a bunch of debug print statements. What I think is happening though, is that the answers coming from the database are correct, but the part where the fields are set appears to reference answers as a class variable. Does this sound correct? From debug output, the self.fields value starts off pretty much empty, then is updated OK the first time. For the second question, the self.fields still has the contents from the first question, until it updates it. Shouldn't this be a separate variable instance per question? Suggestions are welcome. Thanks, Tim (code follows) """ Create the quiz form(s). """ from django import newforms as forms from django.http import Http404 from models import Question class QuestionForm(forms.Form): answers = forms.ChoiceField(widget=forms.RadioSelect()) def __init__(self, question, *args, **kwargs): super(QuestionForm, self).__init__(*args, **kwargs) self.problem = question.problem answers = question.answers.order_by('statement') self.fields['answers'].choices = [(i, a.statement) for i, a in enumerate(answers)] # We need to work out the position of the correct answer in the sorted # list of all possible answers. for pos, answer in enumerate(answers): if answer.id == question.correct_answer_id: self.correct = pos break def is_correct(self): """ Determines if the given answer is correct (for a bound form). """ if not self.is_valid(): return False return self.cleaned_data['answers'] == str(self.correct) def create_quiz_forms(quiz_id, data=None): questions = Question.objects.filter(quiz__pk=quiz_id).order_by('id') form_list = [] for pos, question in enumerate(questions): form_list.append(QuestionForm(question, data, prefix=pos)) if not form_list: # No questions found, so the quiz_id must have been bad. raise Http404('Invalid quiz id.') return form_list --~--~-~--~~~---~--~~ 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: Jquery and form plugin
It might help to share the view that this Ajax call hits. If it's long, you can post it at dpaste so it's easier for folks to read: http://www.dpaste.com I suspect the issue lies in the view, not so much in the JS. /alex On Jan 22, 2008 1:49 PM, mike <[EMAIL PROTECTED]> wrote: > > I am trying to use Jquery's form plugin with django to submit a form > with ajax. When i submit the form the data is posted and the server > responds but the results are not showing up on my form. I can see > from the console output of Firebug that the data is being returned, > but its just not showing any help would be appreciated. > > > > Javascript: > > // wait for the DOM to be loaded > $(document).ready(function() { > // bind 'myForm' and provide a simple callback function > $('#myForm').ajaxForm(function() { > return false; > }); > }); > > > My form: > >VPI: >VCI: > > > > Firebug console results returns correct html: > > > > > Success rate is 100 percent (5/5), round-trip min/avg/ > max = 8/11/12 ms > > > --~--~-~--~~~---~--~~ 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: InnoDB on?
Hi, Le Tue, 22 Jan 2008 11:08:41 -0800 (PST), "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> a écrit : > > I need InnoDB for MySQL to do row locking in hopes of this working > efficiently. > > Is InnoDB on by default in MySQL 5.0? > > How can I tell? Look at the "SHOW ENGINES" SQL query http://dev.mysql.com/doc/refman/5.0/en/show-engines.html - Jonathan --~--~-~--~~~---~--~~ 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 remove email heading "Content-Type"?
Hi, I'm using the attach_alternative command to send html emails. But when I use this command, I always get a "Content-Type: text/html; charset=utf-8" heading in all my emails. Is it possible to get rid of it? Thank you Francis --~--~-~--~~~---~--~~ 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 transaction system
Hi, Le Tue, 22 Jan 2008 11:07:45 -0800 (PST), "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> a écrit : > Example: > Processes P1, P2, model instance m, with m.val > > - P1 grabs the object : m = MyModel.objects.filter(get the m i want) > [0] > - P2 grabs the object : m = MyModel.objects.filter(get the m i want) > [0] > - P1 m.val += 1 > - P2 m.val += 1 > - P1 m.save() > - P2 m.save() > > What happens normally? What happens with the transaction middleware? I guess the save() methods will set directly the new value, instead of sending a "val + 1" UPDATE to the database. So, if m.val == 0 when you load the object in both P1 and P2, it will result in : UPDATE mymodel SET val = 1 WHERE id = ? whereas you want : UPDATE mymodel SET val = val + 1 WHERE id = ? In the latter, the transaction will handle this (well, as Jeff Anderson said, the _database_ will handle this), and your "val" field will be +2. However, I'm pretty sure Django will do the former. It needs to be checked. But, I guess you can add a method (or override the save() method maybe), to send the correct SQL query. - Jonathan --~--~-~--~~~---~--~~ 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 transaction system
Hi, > Let's say I have a model with an integer value. I'd like to increment > that value. > > Multiple processes would like to increment that value. > > Does the transaction middleware properly protect against this? > > Example: > Processes P1, P2, model instance m, with m.val > > - P1 grabs the object : m = MyModel.objects.filter(get the m i want) > [0] > - P2 grabs the object : m = MyModel.objects.filter(get the m i want) > [0] > - P1 m.val += 1 > - P2 m.val += 1 > - P1 m.save() > - P2 m.save() > > What happens normally? What happens with the transaction middleware? The transaction middleware can't do anything special in these situations. The instances of 'm' in processes P1 and P2 are two separate Python object instances. If P2's m.save() gets called after P1's m.save(), then m.val from P2's instance will get saved in the database regardless of the m.val set by P1. The two instances are not connected to each other. > > What happens if the view is more complicated and only conditionally > accesses certain models. Will all models actually accessed be properly > locked? No. The model instances are not locked like this at all. You will need a global shared memory/storage area to simulate an interprocess lock of your own. Realize that your processes could even be on different web servers. For example, you could use a "slot" in memcache to acquire and release a custom lock every time around the statements where you increment m.val. Or you could possibly have a lock management table/model in your database. -Rajesh D --~--~-~--~~~---~--~~ 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 transaction system
Django doesn't handle the transactions directly. It just has support for taking advantage of the transaction capabilities included in the database of your choice. It depends on your database system. Read up on transactions with database x to see how it will behave. With my understanding of transactions, I believe that they are there for that reason... to make sure multiple processes aren't colliding and mudding up your data. Jeff Anderson [EMAIL PROTECTED] wrote: Let's say I have a model with an integer value. I'd like to increment that value. Multiple processes would like to increment that value. Does the transaction middleware properly protect against this? Example: Processes P1, P2, model instance m, with m.val - P1 grabs the object : m = MyModel.objects.filter(get the m i want) [0] - P2 grabs the object : m = MyModel.objects.filter(get the m i want) [0] - P1 m.val += 1 - P2 m.val += 1 - P1 m.save() - P2 m.save() What happens normally? What happens with the transaction middleware? What happens if the view is more complicated and only conditionally accesses certain models. Will all models actually accessed be properly locked? Thanks, Ivan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- signature.asc Description: OpenPGP digital signature
Re: Problems setting mutliple filter for a model
Hi Tim ; ) thanks ... that should work. I will test it at the weekend. I just thought there might be a version without any sql strings.. thank you all for your support bg tim On Jan 21, 5:14 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > You get my problem right. I'm searching for a way to apply a > > filter on already filtered list of products. But don't know a > > way to do that. > > Here's the solution I've proposed to this in the past: > > http://groups.google.com/group/django-users/browse_frm/thread/8e265ae... > > HTH, > > -tim (yet another 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: Template Macros Like In Jinja
You can create an intermediate base class that extends your base class and includes elements like: {% if actions %} ... show action table ... {% endif %} {% if element %} ... show edit element form ... {% else %} ... show add element form ... {% endif %} and so forth and so on. Now your page appearance is controlled by whether or not you pass in corresponding data elements. This is not a true replacement for templates, but it does allow for consolidation of repeating visual elements across a set of pages. On Jan 21, 8:30 pm, "Papalagi Pakeha" <[EMAIL PROTECTED]> wrote: > hi there! > > i wonder if there is any way to have Macros in django templates > similar to what Jinja has (http://jinja.pocoo.org/)? > --~--~-~--~~~---~--~~ 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: InnoDB on?
Hello, As far as I know, InnoDB is only the default storage engine for MySQL on Windows. For UNIX/Linux, it is still MyISAM. Changing that should be as simple as adding the following line to you my.cnf on the [mysqld] and/or [mysqld_safe] sections: default-storage-engine=innodb Also, make sure any "skip-innodb" lines which may be on your my.cnf file are commented out. I personally used the official GUI (avaible on Ubuntu on the mysql-admin package) to set that, as I too had troubles finding an easy and comprehensive tutorial for this in the past, but this should hopefully be enough. Hope it helps, Eduardo "IdNotFound" On Jan 22, 2008 5:08 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I need InnoDB for MySQL to do row locking in hopes of this working > efficiently. > > Is InnoDB on by default in MySQL 5.0? > > How can I tell? > > I need to create a my.cnf to set it up as the engine to use if it > isn't active, right? Any good resources on that? > > Thanks, > Ivan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Jquery and form plugin
I am trying to use Jquery's form plugin with django to submit a form with ajax. When i submit the form the data is posted and the server responds but the results are not showing up on my form. I can see from the console output of Firebug that the data is being returned, but its just not showing any help would be appreciated. Javascript: // wait for the DOM to be loaded $(document).ready(function() { // bind 'myForm' and provide a simple callback function $('#myForm').ajaxForm(function() { return false; }); }); My form: VPI: VCI: Firebug console results returns correct html: Success rate is 100 percent (5/5), round-trip min/avg/ max = 8/11/12 ms --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
InnoDB on?
I need InnoDB for MySQL to do row locking in hopes of this working efficiently. Is InnoDB on by default in MySQL 5.0? How can I tell? I need to create a my.cnf to set it up as the engine to use if it isn't active, right? Any good resources on that? Thanks, Ivan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
django transaction system
Let's say I have a model with an integer value. I'd like to increment that value. Multiple processes would like to increment that value. Does the transaction middleware properly protect against this? Example: Processes P1, P2, model instance m, with m.val - P1 grabs the object : m = MyModel.objects.filter(get the m i want) [0] - P2 grabs the object : m = MyModel.objects.filter(get the m i want) [0] - P1 m.val += 1 - P2 m.val += 1 - P1 m.save() - P2 m.save() What happens normally? What happens with the transaction middleware? What happens if the view is more complicated and only conditionally accesses certain models. Will all models actually accessed be properly locked? Thanks, Ivan --~--~-~--~~~---~--~~ 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: Accessor clashes related field
Karen Tracey wrote: > On Jan 22, 2008 3:00 AM, Carl Karsten <[EMAIL PROTECTED]> wrote: > >> # core/models.py >> from django.db import models >> from django.contrib.auth.models import User >> import ridgemoor.msg.models >> from time import strftime >> >> class Message(models.Model): >> to = models.ForeignKey(User, related_name = "messages_received") >> sender = models.ForeignKey(User, related_name = "messages_sent") >> subject = models.CharField(max_length=50, blank=False) >> sent = models.DateTimeField(auto_now_add=True) >> recieved = models.DateTimeField(null=True) >> body = models.TextField() >> status = models.CharField(max_length=1, blank=True, null=True) >> def __str__(self): >> return self.subject >> class Admin: >> list_display = ('sent', 'to', 'sender', 'subject') >> >> >> [EMAIL PROTECTED]:~/ridgemoor$ PYTHONPATH=$HOME ./manage.py syncdb >> Error: One or more models did not validate: >> core.message: Accessor for field 'to' clashes with related field >> 'User.messages_received'. Add a related_name argument to the definition >> for 'to'. >> >> Something broke my app. it is most likely the changes I have been making >> to get >> things working under apache, but this may be a change to trunk. >> >> It is telling me to add something that is already there. > > > The error is telling you that by the time the "to" field of Message is > processed, User already has a "messages_received" relation. Yes, the > message is a bit misleading, since you already have a related_name field, > but what it really means is you need to specify a related_name that doesn't > already exist for User. What is in ridgemoor.msg.models? I'd guess there's > another model with a ForeignKey to User specifying a related_name of > "messages_received". Do you really need two models with this relation? If > so you'll need to specify different related_names for the two. > Ah! bingo. fixed. in answer to your question: # msg/model.py class Message(models.Model): to = models.ForeignKey(User, related_name = "messages_received") sender = models.ForeignKey(User, related_name = "messages_sent") and for the last 6 months I had been using: class Message(msg.models.Model): status = models.CharField(max_length=1, blank=True, null=True) and in at least one: # class Meta: #db_table = 'message' I did this before I learned you shouldn't do it. It worked, might still work, but when I started bumping into problems I figured I better flatten it out. So I cut/pasted the attributes, changed the parent class to models.Model, and figured that would be all I needed. Didn't occur to me that relations create keys in other tables - now I see the copies are colliding. Thanks for helping me. Carl K --~--~-~--~~~---~--~~ 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 can't connect to postgresql
On Jan 21, 8:28 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 21-Jan-08, at 10:32 PM, LRP wrote: > this is an unsafe default for you to get things working. Now > experiment with using password or md5 or ident for authentication > Thanks, Kenneth, I've got it working with md5. One of the things I've learned is that you need to pass a a parameter to Postgresql when you launch it to use the TCP/IP host options. Haven't tried that yet. So many fascinating things to learn... Thanks again, Lloyd --~--~-~--~~~---~--~~ 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: Can we use encode out of unicode form?
2008/1/22 calidion <[EMAIL PROTECTED]>: > hi all, > I am a user from china, nice to meet u all. > I have a question, hope you can help me out. > > and the question is about how to load my pages into template. > my pages are all encoded in form gb2312/gbk. > but when i load it to Template, it raise exceptions. > can i solve this without change the encoding? > > Without specifics it is a little hard to help. If you describe exactly what code is generating what exceptions (including traceback) someone may be able to provide guidance. Also make sure to note what version of Django you are using. For good Unicode support you will need to be using something more recent than 0.96. Karen --~--~-~--~~~---~--~~ 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: Passing form initial values from one view to another?
On Jan 20, 2008 11:58 PM, Dennis <[EMAIL PROTECTED]> wrote: > > This works from the standpoint of getting back to the "process.html" > template with the new Context object selected on the original form. > However, since this is using render_to_response instead of a redirect, > the URL on the user's browser still holds the "create_context" > location. So, when the user hits "submit" on the process.html page, > the form gets sent back to the "create_context" view and things don't > operate as expected (another context gets created rather than > submitting to the "process_task" view) > > The ideal way to do this would be to HttpResponseRedirect in place of > the "render_to_response" but this doesn't allow me to pass the form > object or any kind of dictionary representing the initial values. Is > there a way to do this? Or am I going about this in the wrong manner? > Hi Dennis, You are right that the ideal way would be to return an HttpResponseRedirect, and that's what I would do too. You can pass the id of the created context object as a parameter in the request back to the 'process_task' view. For example, your create_context view would look like this: def create_context( request ): if request.method == 'POST': form = CreateContextForm(request.POST) if form.is_valid(): # Do form processing here... # todo: clean_data is legacy, will need to be changed # to cleaned_data in next release. data = form.clean_data c = Context.objects.create( name=data['name'] ) # Pass the context id in the 'newcontext' parameter return HttpResponseRedirect('/process/?newcontext=%s' % c.id) else: form = CreateContextForm() return render_to_response('create_projctx.html', {'form':form}) Then your process_task view would be changed to check if there is a 'newcontext' parameter available in your request, in which case you use it to set the initial data of the form. def process_task(request): if request.method == 'POST': form = ProcessForm(request.POST) if form.is_valid(): # Do form processing here... # todo: clean_data is legacy, will need to be changed # to cleaned_data in next release. data = form.clean_data t = Task.objects.create( context=data['context'] , due_date=data['due_date'] ) return HttpResponseRedirect( request.META['HTTP_REFERER'] ) else: form = ProcessForm(initial={ 'context': request.GET.get('newcontext', None) }) return render_to_response('process.html', {'form': form}) The important part here is this: form = ProcessForm(initial={ 'context': request.GET.get('newcontext', None) }) You are setting an initial context depending on the value of the 'newcontext' request parameter, but because that parameter may not always be present you need to use the .get() method, the first parameter is the key to get from the dictionary and the second parameter is a value to return if the key is not found. In this case, when 'newcontext' is not found you'll get a None value back. After you create a new context on the other view and get redirected to process_task, there should be a value in the 'newcontext' request parameter, and the form will render with that context selected. Also note that this line: return HttpResponseRedirect( request.META['HTTP_REFERER'] ) will cause you problems because after creating a context, the referrer will be the /create_context/ page. Hope this helps. Regards, - Jorge --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Can we use encode out of unicode form?
hi all, I am a user from china, nice to meet u all. I have a question, hope you can help me out. and the question is about how to load my pages into template. my pages are all encoded in form gb2312/gbk. but when i load it to Template, it raise exceptions. can i solve this without change the encoding? thx for your kindness. thank u. Yours, calidion --~--~-~--~~~---~--~~ 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: Tutorial03: question about efficiency
Hi, As others have aptly told you, Querysets are executed in a lazy fashion. I would like to add that Django resolves the array slicing syntax (e.g. queryset[:5]) to the LIMIT clause in SQL. So, when your Poll Queryset is executed (lazily, of course), your DB will send only the 5 rows of data over the network to Django. -Rajesh D --~--~-~--~~~---~--~~ 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: Tutorial03: question about efficiency
Thanx all for explanations :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Query question
I have an agreement model that can be "amended" using a relationship to itself. I need to get a queryset of the active agreements for a certain time period but the following query does not work i believe because of the way the Django orm handles joins. Can this query be expressed using the Django orm? return self.exclude(Q(date_effective__gt=dtuntil) | Q(date_expires__lt=dtstart) | Q(date_terminated__isnull=False)) \ .filter(Q(amendment__isnull=True) | Q(amendment__date_effective__gt=dtstart)) - 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: Loading fixtures from views
Thank you, Alex. Your response was very helpful. On Jan 20, 12:21 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote: > Try this code: > > from django.core.management.commands.loaddata import Command > > def my_view( request, fixture_label1, fixture_label2 ) > Command().handle( fixture_label1, fixture_label2 ) > #... > > On 20 янв, 20:04, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > To support testing (using Selenium), I would like to invoke fixtures > > from regular Django views. More generally, I want to be able to > > perform test setup and teardown operations from Selenium which > > interacts with the application through http. > > > I know that fixtures are normally part of Django tests (rather than > > Selenium) and are invoked vie the "manage.py" script. Does anyone > > have an idea about how to invoke fixtures from views? > > > Thanks, > > Doug --~--~-~--~~~---~--~~ 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: Loading fixtures from views
This works. Thank you. On Jan 20, 11:33 am, Jonathan Buchanan <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > To support testing (using Selenium), I would like to invoke fixtures > > from regular Django views. More generally, I want to be able to > > perform test setup and teardown operations from Selenium which > > interacts with the application through http. > > > I know that fixtures are normally part of Django tests (rather than > > Selenium) and are invoked vie the "manage.py" script. Does anyone > > have an idea about how to invoke fixtures from views? > > > Thanks, > > Doug > > Here's an example of using the management commands programmatically: > > http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Chang... > > Jonathan. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
empty PATH_INFO with LiteSpeed / FastCGI
I have been setting up a site with LiteSpeed serving Django. the basics work, but I end up with an error when requesting http://mysite.com/. TypeError at 'NoneType' object is not iterable at django/django/core/ handlers/base.py in get_response, line 73. It seems very related to the ticket 3414, http://code.djangoproject.com/ticket/3414. the second patch on that ticket fixes the problem. setting APPEND_SLASH does not affect it at all. I'd like to find a way to set environ['PATH_INFO'] without changing code in the django trunk and wondering if there would be a way in the code that is executed by LiteSpeed. Right now, it's using manage.py runfcgi daemonize=false method=threaded. The examples on this page: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango, include some code that deals with the issue, but I can't quite see how to use that method with LiteSpeed, or lighttpd. Thanks for any input or direction on how to approach this, dc --~--~-~--~~~---~--~~ 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: Accessor clashes related field
On Jan 22, 2008 3:00 AM, Carl Karsten <[EMAIL PROTECTED]> wrote: > # core/models.py > from django.db import models > from django.contrib.auth.models import User > import ridgemoor.msg.models > from time import strftime > > class Message(models.Model): > to = models.ForeignKey(User, related_name = "messages_received") > sender = models.ForeignKey(User, related_name = "messages_sent") > subject = models.CharField(max_length=50, blank=False) > sent = models.DateTimeField(auto_now_add=True) > recieved = models.DateTimeField(null=True) > body = models.TextField() > status = models.CharField(max_length=1, blank=True, null=True) > def __str__(self): > return self.subject > class Admin: > list_display = ('sent', 'to', 'sender', 'subject') > > > [EMAIL PROTECTED]:~/ridgemoor$ PYTHONPATH=$HOME ./manage.py syncdb > Error: One or more models did not validate: > core.message: Accessor for field 'to' clashes with related field > 'User.messages_received'. Add a related_name argument to the definition > for 'to'. > > Something broke my app. it is most likely the changes I have been making > to get > things working under apache, but this may be a change to trunk. > > It is telling me to add something that is already there. The error is telling you that by the time the "to" field of Message is processed, User already has a "messages_received" relation. Yes, the message is a bit misleading, since you already have a related_name field, but what it really means is you need to specify a related_name that doesn't already exist for User. What is in ridgemoor.msg.models? I'd guess there's another model with a ForeignKey to User specifying a related_name of "messages_received". Do you really need two models with this relation? If so you'll need to specify different related_names for the two. Karen --~--~-~--~~~---~--~~ 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: Understanding Django and JSON
> Server-side code > - > . > json_data = serializers.deserialize("json", request.POST['data']) > print "\n" + str(sjson_data) > . Typo above. Should be: print "\n" + str(json_data) --~--~-~--~~~---~--~~ 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: Template Macros Like In Jinja
On Jan 21, 2008 8:30 PM, Papalagi Pakeha <[EMAIL PROTECTED]> wrote: > i wonder if there is any way to have Macros in django templates > similar to what Jinja has (http://jinja.pocoo.org/)? No. The Jinja project was started specifically to add additional programming constructs that the Django template system does not and likely will not implement. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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: create form with preselected value
thanks, karen i didnt know the dynamic intial values yet. django surprises me over and over again :-) lowshoe --~--~-~--~~~---~--~~ 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: Tutorial03: question about efficiency
On Jan 22, 2008 8:16 AM, code_berzerker <[EMAIL PROTECTED]> wrote: > this gives 5 Poll objects. I wonder if this is efficient way of > getting them? Does django get all rows first and then sort it and then > slice it to get only 5? Or is it optimized somehow. The question is if > its simplified for the tutorial and inefficient or this is the right > way to do it? It's right. If you keep reading, you'll see (in tutorial part 4) a note which explains this: "Note all() is lazy It might look a little frightening to see Poll.objects.all() being used in a detail view which only needs one Poll object, but don't worry; Poll.objects.all() is actually a special object called a QuerySet, which is "lazy" and doesn't hit your database until it absolutely has to. By the time the database query happens, the object_detail generic view will have narrowed its scope down to a single object, so the eventual query will only select one row from the database. If you'd like to know more about how that works, The Django database API documentation explains the lazy nature of QuerySet objects." -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Understanding Django and JSON
Hi All, I'm running into a situation that completely baffles me. I am writing unit tests for my Django view that accepts JSON and returns JSON back to the client. Right now, the client is the Django unit test client. What I've done is in my test, I create a Django model object, let's call it Person for now. I serialize that to JSON and then use client.post('VIEWURL', {'data': person_as_json}). Whenever I retrieve the data, using request.POST['data'], I get a string that Django says cannot be deserialized. (No JSON object could be decoded) If I deserialize the exact same string in my test case, it deserializes just fine. In fact, if I use simplejson from django.utils to deserialize the JSON string in request.POST['data'], simplejson has no problem deserializing it. Now before I ask any specific questions, let me give you some background on my needs. I am writing a Django-based server for a management application. (This application will be managing objects via forms and such.) My plan is to have a a client that is not Python based which is where JSON comes in since JSON parser implementations are available in many languages. Now, whenever I want to create a new Person object on the server, my client creates a Person representation, using form fields/ values, and submits to the server. Well, it sounds pretty simple until Django tries to deserialize. Since I'm writing the client, there is no reason I couldn't create a Django-specific JSON encoder on my client so that Django could deserialize but even that appears to be failing since a JSON string deserializes fine in my test but not when retrieved from request.POST['data']. So here are my questions: 1) Does anyone know of a detailed example of doing this? I've googled but not found anything that helps me get past this. 2) Anyone know why a string would be Django-deserializable in a unit test but not on the server? I may be missing a step during the retrieval from request.POST but I've not found any reference to this missing step(s). 3) Is this a viable approach? Can I create a Django-specific JSON encoder on my client and deserialize on the server or should I use another approach like submitting form contents as key/value pairs and then iterating over them on the server to create my object needing to be saved. I can give you code if you'd like but for brevity, here are examples of what I'm doing in my unit tests and on the server: Unit test code - . rc = create_repository_container() data = serializers.serialize("json", [rc], ensure_ascii=False) print "\n" + data . Unit test output -- [{"pk": null, "model": "svn.repositorycontainer", "fields": {"display_name": "Repository Container 1", "description": "Repository Container 1 description", "server_type": "Apache", "created": null, "authz_path": "/Users/jwhitlock/dev/raven/server/raven_server/../ raven_server/svn/data/1/container_1.authz", "active": true, "path": "/ Users/jwhitlock/dev/raven/server/raven_server/../raven_server/svn/data/ 1"}}] Server-side code - . json_data = serializers.deserialize("json", request.POST['data']) print "\n" + str(sjson_data) . Server-side output --- [{"pk": null, "model": "svn.repositorycontainer", "fields": {"display_name": "Repository Container 1", "description": "Repository Container 1 description", "server_type": "Apache", "created": null, "authz_path": "/Users/jwhitlock/dev/raven/server/raven_server/../ raven_server/svn/data/1/container_1.authz", "active": true, "path": "/ Users/jwhitlock/dev/raven/server/raven_server/../raven_server/svn/data/ 1"}}] >From what I can tell, the strings are the same yet the unit tests successfully deserializes while the server-side creates the following error: No JSON object could be decoded Any help would be appreciated. Take care, Jeremy --~--~-~--~~~---~--~~ 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: Tutorial03: question about efficiency
On Tuesday 22 January 2008 16:16:34 code_berzerker wrote: > theres line of code in tutorial: > > Poll.objects.all().order_by('-pub_date')[:5] > > this gives 5 Poll objects. I wonder if this is efficient way of > getting them? Does django get all rows first and then sort it and then > slice it to get only 5? Or is it optimized somehow. The question is if > its simplified for the tutorial and inefficient or this is the right > way to do it? this is the right way.. qs = Poll.objects.all().order_by('-pub_date')[:5] qs now is only 'queryset', and real query into database happen when you iterating objetcs e.g. for poll in qs: do_something_with(i) or {% for poll in polls %}...{% endfor %} all this calls (order_by,filter...) only affects future query --~--~-~--~~~---~--~~ 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: Tutorial03: question about efficiency
This is the right way to do so. Querysets are lazy. Only the rows needed will be fetched in this example. code_berzerker wrote: > theres line of code in tutorial: > > Poll.objects.all().order_by('-pub_date')[:5] > > this gives 5 Poll objects. I wonder if this is efficient way of > getting them? Does django get all rows first and then sort it and then > slice it to get only 5? Or is it optimized somehow. The question is if > its simplified for the tutorial and inefficient or this is the right > way to do it? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Tutorial03: question about efficiency
theres line of code in tutorial: Poll.objects.all().order_by('-pub_date')[:5] this gives 5 Poll objects. I wonder if this is efficient way of getting them? Does django get all rows first and then sort it and then slice it to get only 5? Or is it optimized somehow. The question is if its simplified for the tutorial and inefficient or this is the right way to do it? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Getting string index out of range error on using DateField
I have field in a form like, foo = forms.DateField(required = False, input_formats = '%m/%d/%Y') Now when I try to enter a date like 10/25/2006 I am getting an error string index out of range . Full stack trace, Traceback: File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in get_response 82. response = callback(request, *callback_args, **callback_kwargs) File "F:\djangoprojects\todolist\todidlist\views.py" in edit_item 51. if form.is_valid(): File "C:\Python24\lib\site-packages\django\newforms\forms.py" in is_valid 95. return self.is_bound and not bool(self.errors) File "C:\Python24\lib\site-packages\django\newforms\forms.py" in _get_errors 86. self.full_clean() File "C:\Python24\lib\site-packages\django\newforms\forms.py" in full_clean 189. value = field.clean(value) File "C:\Python24\lib\site-packages\django\newforms\fields.py" in clean 283. return datetime.date(*time.strptime(value, format)[:3]) File "C:\Python24\lib\_strptime.py" in strptime 287. format_regex = time_re.compile(format) File "C:\Python24\lib\_strptime.py" in compile 264. return re_compile(self.pattern(format), IGNORECASE) File "C:\Python24\lib\_strptime.py" in pattern 256. processed_format = "%s%s%s" % (processed_format, Exception Type: IndexError at /edititem/2/ Exception Value: string index out of range --~--~-~--~~~---~--~~ 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 apply a class to a specific field's label in newforms
On 22-Jan-08, at 6:35 PM, shabda wrote: > My template is > > {% for field in form %} > > {{ field.label_tag }} > {{field}} > {% if field.help_text > %}{{ field.help_text }}{% endif %} > {% if field.errors %} class="myerrors">{{ field.errors }}{% endif %} > > {% endfor %} > > How can I check the name of the current field? say your field is called 'somefield' then: {% ifequal field.name 'somefield' %} special code here {% endifequal %} this way you can do very fine-grained control -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ Foss Conference for the common man: http://registration.fossconf.in/web/ --~--~-~--~~~---~--~~ 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 apply a class to a specific field's label in newforms
My template is {% for field in form %} {{ field.label_tag }} {{field}} {% if field.help_text %}{{ field.help_text }}{% endif %} {% if field.errors %}{{ field.errors }}{% endif %} {% endfor %} How can I check the name of the current field? On Jan 22, 5:23 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 22-Jan-08, at 5:45 PM, shabda wrote: > > > I want to have the one of the field for my form have a specific css > > class. But if I do something like, > > widget = forms.TextInput(attrs = {'size':60, 'class':'main'} > > The textInput, and not its associated label gets the class. How can I > > specify the class for label? > > you can break down the form and do it inside the template > > -- > > regards > kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/ > Foss Conference for the common man:http://registration.fossconf.in/web/ --~--~-~--~~~---~--~~ 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: differences between runserver and apache
Graham Dumpleton wrote: > On Jan 22, 6:18 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: >> Carl Karsten wrote: >>> symlinks. I use them. I bet the default is for Apache not to follow them. >>> that >>> could be my problem. or at least one of them. >>> That is enough to start a wiki page. >>> I am going to divide it into rumors and confirmed rumors. Anyone have some >>> rumors for me to post? >> If so, please dump them here. >> >> http://code.djangoproject.com/wiki/devserver_and_apache_differences > > The differences have been dealt with before. See: > > > http://groups.google.com/group/django-users/browse_frm/thread/24deb095a2b2e450/f8e703bbb96e9e88?lnk=gst=Graham+setup_environ+PythonPath#f8e703bbb96e9e88 > > Your page is just making things more confusing. The dev server has > nothing to do with PythonPath, you probably mean sys.path, but it is whoops. right. I was thinking 'path' but wanted to make it clear it wasn't the OS $PATH path. > more complicated that you know as explained in referenced post. I'll read the links later today. have to go drive around in the snow. wish me luck :) Carl K > > Also, whether Apache follows symlinks has got nothing to do with it. > That aspect of Apache only comes into play when serving static files > or you have script files in the directories directly served by Apache, > neither of which apply to Django unless you so happen to have also > configured Apache to serve up the Django media files which your > configuration does not show you are doing. > > If you want a list of the things that can come up when using Apache, > you are better off reading: > > http://code.google.com/p/modwsgi/wiki/ApplicationIssues > > This is for mod_wsgi, but lots of the issues such as file access > permissions etc etc, also apply to mod_python. > > You may also want to read: > > http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango > > which explicitly mentions the need to add both the site and site > parent directory to sys.path (through whatever means), if you > reference stuff not through the site name. > > Graham > > > > > --~--~-~--~~~---~--~~ 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: considering django for The Freesound Project, some (de)constructive critisism
On Jan 21, 4:22 pm, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > 2. file uploads are the most vital part of freesound. While I have used > tramline successfully with splice, it still feels like a relatively ugly > solution to me (especially as you need to patch mod_python in order for > it to work). As far as I know streaming file uploads have been on the > todo for more than a year. Some load balancers (include the ability to handle streaming file uploads for you. Essentially, the load balancer can intercept the file upload and write it to disk as it slowly comes in, then splurge it all through to the application running behind it at once when the whole file is available to the load balancer. I'm pretty sure Perlbal has this ability. Would this solve your file upload problem, or is there something else that I'm missing? Cheers, Simon Willison --~--~-~--~~~---~--~~ 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: differences between runserver and apache
I never got it working back then. I was thinking of bringing up a test Apache box right from the start, but it seemed more important to get a prototype site functioning. Now I am ready to actually use Apache, so here we are. Thanks for your efforts - and like my page says: rumors. I will note that symlinks do not effect finding python files. Thanks. Carl K Graham Dumpleton wrote: > BTW, Carl. > > I note that you actually directly responded to that old thread I > referenced explaining the subtle differences, so you would have been > aware of how to set things up back then, so not sure why you are > having trouble now. ;-) > > Graham > > On Jan 22, 6:51 pm, Graham Dumpleton <[EMAIL PROTECTED]> > wrote: >> On Jan 22, 6:18 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: >> >>> Carl Karsten wrote: symlinks. I use them. I bet the default is for Apache not to follow them. that could be my problem. or at least one of them. That is enough to start a wiki page. I am going to divide it into rumors and confirmed rumors. Anyone have some rumors for me to post? >>> If so, please dump them here. >>> http://code.djangoproject.com/wiki/devserver_and_apache_differences >> The differences have been dealt with before. See: >> >> http://groups.google.com/group/django-users/browse_frm/thread/24deb09... >> >> Your page is just making things more confusing. The dev server has >> nothing to do with PythonPath, you probably mean sys.path, but it is >> more complicated that you know as explained in referenced post. >> >> Also, whether Apache follows symlinks has got nothing to do with it. >> That aspect of Apache only comes into play when serving static files >> or you have script files in the directories directly served by Apache, >> neither of which apply to Django unless you so happen to have also >> configured Apache to serve up the Django media files which your >> configuration does not show you are doing. >> >> If you want a list of the things that can come up when using Apache, >> you are better off reading: >> >> http://code.google.com/p/modwsgi/wiki/ApplicationIssues >> >> This is for mod_wsgi, but lots of the issues such as file access >> permissions etc etc, also apply to mod_python. >> >> You may also want to read: >> >> http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango >> >> which explicitly mentions the need to add both the site and site >> parent directory to sys.path (through whatever means), if you >> reference stuff not through the site name. >> >> Graham > > > --~--~-~--~~~---~--~~ 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 apply a class to a specific field's label in newforms
On 22-Jan-08, at 5:45 PM, shabda wrote: > I want to have the one of the field for my form have a specific css > class. But if I do something like, > widget = forms.TextInput(attrs = {'size':60, 'class':'main'} > The textInput, and not its associated label gets the class. How can I > specify the class for label? you can break down the form and do it inside the template -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ Foss Conference for the common man: http://registration.fossconf.in/web/ --~--~-~--~~~---~--~~ 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: filtering on a date field's component; a bug?
yes, "start_date" is the date field. shabda, I want to filter by the month attribute of a date field and it works for exact match. In a filter, a date field's year, month and day attributes can be used like filter(start_date__month=1). I think filter(start_date__month__in=[1, 2, 3]) format should be supported. I will submit it as a feature request to trac. On Jan 22, 2:58 am, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > omat wrote: > > Hi all, > > > I have a model with a date field. When I try to filter based on its > > months like: > > > q1 = Event.objects.filter(start_date__month__in=[1, 2, 3]) > > > I get an "unable to resolve field 'start_date__month'" error. > > > Is this usage not supported or is this a bug? > > afaik this isn't supported (I'm assuming start_date is a date field) > > you could use > > http://www.djangoproject.com/documentation/db-api/#extra-select-none-... > > - bram --~--~-~--~~~---~--~~ 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 apply a class to a specific field's label in newforms
I want to have the one of the field for my form have a specific css class. But if I do something like, widget = forms.TextInput(attrs = {'size':60, 'class':'main'} The textInput, and not its associated label gets the class. How can I specify the class for label? --~--~-~--~~~---~--~~ 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: separate template internationalization problem. where to put locale/ dir?
On 22-Jan-08, at 4:11 PM, sector119 wrote: > All my sources are in the /home/sector119/devel/eps_src/eps > All applications are in /home/sector119/devel/eps_src/eps/apps > And all my templates are in /home/sector119/devel/eps_src/templates > dir which contains app_name dir which contains templates for that > application! you have to have some root for your application - if all the applications are part of the same project. All strings to be translated have to be in files under that root and locale/ should be in that root -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ Foss Conference for the common man: http://registration.fossconf.in/web/ --~--~-~--~~~---~--~~ 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: filtering on a date field's component; a bug?
omat wrote: > Hi all, > > I have a model with a date field. When I try to filter based on its > months like: > > q1 = Event.objects.filter(start_date__month__in=[1, 2, 3]) > > I get an "unable to resolve field 'start_date__month'" error. > > Is this usage not supported or is this a bug? afaik this isn't supported (I'm assuming start_date is a date field) you could use http://www.djangoproject.com/documentation/db-api/#extra-select-none-where-none-params-none-tables-none - bram --~--~-~--~~~---~--~~ 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: open flash chart & django
ok, I finally got open-flash-chart to work. 1. create an xhtml-file and insert (something like) this: http://fpdownload.macromedia.com/pub/shockwave/cabs/ flash/swflash.cab#version=8,0,0,0" width="600" height="400" id="graph-2" align="middle"> http://www.macromedia.com/go/getflashplayer; /> 2. define the url for the chart, eg: (r'^chart/$', 'www.views.charts.chart'), 3. define the url for the chart-data, e.g.: (r'^chart_data/$', 'www.views.charts.chart_data'), 4. the views: def chart(request): ### nothing really required. whatever you want to do here. points to the html-file created above return render_to_response('site/charts/chart.html', { 'var': 'var', }, context_instance=RequestContext(request) ) def chart_data(request): import random g = graph() data_1 = [] data_2 = [] data_3 = [] for i in range(12): data_1.append( random.randint(14,19) ) data_2.append( random.randint(8,13) ) data_3.append( random.randint(1,7) ) g.title('PageViews (2007)', '{color: #99; font-size: 16; text- align: center}' ); g.bg_colour = '#ff' # we add 3 sets of data: g.set_data( data_1 ) g.set_data( data_2 ) g.set_data( data_3 ) # we add the 3 line types and key labels g.line_dot( 3, 5, '#33', 'Page views', 10 ) g.line_dot( 3, 5, '#66', 'Visits', 10)# <-- 3px thick + dots g.line_hollow( 2, 4, '#99', 'Unique visitors', 10 ) g.set_x_labels( 'Jänner,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember'.split(',') ) g.set_x_label_style( 11, '0x66', 2, 1) g.set_y_max(20) g.y_label_steps(4) g.set_y_label_style( 10, '0x66') return HttpResponse(g.render()) that´s it. works quite well. I customized some of the .as-files to get the look & feel of our site. 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 -~--~~~~--~~--~--~---
separate template internationalization problem. where to put locale/ dir?
Hi All! All my sources are in the /home/sector119/devel/eps_src/eps All applications are in /home/sector119/devel/eps_src/eps/apps And all my templates are in /home/sector119/devel/eps_src/templates dir which contains app_name dir which contains templates for that application! Where I have to put locale/ dir to handle translations from my template? If I put it in /home/sector119/devel/eps_src/templates/APP_NAME directory Django daesn't handle translations for this app templates. I don't want to add /home/sector119/devel/eps_src/templates/APP_NAME path for all my apps to the LOCALE_PATHS in my settings, it's not handy, I think. What is the best way to handle translations for templates in my case? My settings.py TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source', ) TEMPLATE_DIRS = ( '/home/sector119/devel/eps_src/templates', ) --~--~-~--~~~---~--~~ 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: considering django for The Freesound Project, some (de)constructive critisism
Hello all, James Bennett wrote: > The fix has been in Django since the day it was publicly released: > 'raw_id_admin=True'. You think World Online runs sites with tens of > thousands of users and hundreds of thousands of stories without > running into that? ;) Ah... Those details one tends to skip over while reading the manual :) >> 2. file uploads are the most vital part of freesound. > > This is one of those things that's taking a while because it's a > genuinely hard problem. The ticket is there, it's under more or less > constant work, so if it's important to you pitch in and help. File uploads seem a very advanced field, looking at the patches. I feel VERY incompetent in this field, so my help would hardly be useful. Neither do I have a lot a of time to experiment, ... As you can understand, this becomes a rather difficult problem. >> 3. finegrained permissions. > > I keep meaning to write a blog entry on how easy it is to do this in > newforms-admin; all the ugly hacks people have come up with to try to > do this just go away. This does look exactly like what I need... Looking at the tickets in svn, newforms-admin looks to be very far from done... Can newforms-admin be used as is? Does it have the equivalent of BackwardsIncompatibleChanges ? >> 4. profiles and get_profile() > > Big overhead how? get_profile() hangs on to its result so it won't > need to query again. As -most likely- all your objects refer to user and not profile one always tends to go through user and query get_profile. For example, say you have books and you want to list a list of 20 books, their authors and their birthday: {% for book in books %} {{ book.author.get_profile.birthday }} {% endfor %} which will invariably trigger another query "from" the template for each book you display, making it hard to control where exactly extra queries will be "generated". Now you are going from one big and fast "join" query to 20 smaller ones. Were there some method of adding information to User, one could (more easily) use of select_related to get the information in one big query and do: {% for book in books %} {{ book.author.birthday }} {% endfor %} Which also LOOKS a lot cleaner. > Also, the "hacky" method is dangerous when you have multiple sites (if > Site A and Site B both want to add a field of the same name, whose > field "wins"?). That's true, but in 99.9% of the cases you would be involved in both the code for siteA and siteB. - bram --~--~-~--~~~---~--~~ 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: filtering on a date field's component; a bug?
You have two underscores after start_date in start_date__month, probably that is the problem. Change this to start_date_month, (one underscore) and see if it works. On Jan 22, 2:15 pm, omat <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a model with a date field. When I try to filter based on its > months like: > > q1 = Event.objects.filter(start_date__month__in=[1, 2, 3]) > > I get an "unable to resolve field 'start_date__month'" error. > > Is this usage not supported or is this a bug? > > Any ideas? > > Thanks, > oMat --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
filtering on a date field's component; a bug?
Hi all, I have a model with a date field. When I try to filter based on its months like: q1 = Event.objects.filter(start_date__month__in=[1, 2, 3]) I get an "unable to resolve field 'start_date__month'" error. Is this usage not supported or is this a bug? Any ideas? Thanks, oMat --~--~-~--~~~---~--~~ 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: Template Macros Like In Jinja
Correct me if I'm wrong, but can't jinja be pretty much used as a direct drop in for django? Ben On 22/01/2008, Jeff Anderson <[EMAIL PROTECTED]> wrote: > > Hello, > > I stress again that I don't know a ton about the django template system, > (or any for that matter) > That being said, I will proceed to say what I think I know: > > I don't believe that there is a macro-like feature in the django > template system that could do that. You'd have to switch completely to > jinja in order to get that functionality. I know that isn't what you > want to hear. > It sounds like that it would be a useful feature... > > > > In my handful of searches, I couldn't find an open ticket for such a > feature. You could create one to suggest it. > It would be something I could learn to use in my templates, given it was > available. > > Good luck! > > Jeff Anderson > > [EMAIL PROTECTED] wrote: > > hi jeff, thanks for your response. > > > > writing tags to replace macros looks like an overkill to me. > > especially because a macro may hold a content that's specific to a > > template and such a thing naturally belongs to the template itself and > > shouldn't go somewhere deep into the python codebase. > > > > have this example simplified from my app i'm where with Jinja I could > > have: > > > > {% macro display_person name, email %} > > mailto:{{ email }}">{{name}} > > {% endmacro %} > > > > Subscribed people > > {% for person in persons.subscribed %} > > {{ display_person(person.name, person.email) }} > > {% endfor %} > > > > Not subscribed people > > {% for person in persons.notsubscribed %} > > {{ display_person(person.name, person.email) }} > > {% endfor %} > > > > having "display_person" as a template tag looks like a total overkill > > given the relative complexity of writing template tags. and having the > > simple in a separate file for 'include' doesn't look > > sane either. it's just a piece of reusable html/template that > > logically belongs to the template itself. > > > > is there any way perhaps with 'block' tag to achieve this macro-like > > behaviour? > > > > thanks > > > > papa > > > > On Jan 22, 3:47 pm, Jeff Anderson <[EMAIL PROTECTED]> wrote: > > > >> I'm no expert with any template system, but I believe you can write > your > >> own template tags for django's template system. > >> > >> http://www.djangoproject.com/documentation/templates_python/ > >> > >> At the section called "Extending the template system" > >> > >> Hopefully this is a good starting point! > >> > >> Jeff Anderson > >> > >> Papalagi Pakeha wrote: > >> > >>> hi there! > >>> > >>> i wonder if there is any way to have Macros in django templates > >>> similar to what Jinja has (http://jinja.pocoo.org/)? > >>> > >>> the closest i could get was using 'include' tag and have the > >>> repetitive content in a standalone file, but it's pretty obscure to > >>> have a separate file for each little bit of content that to be > >>> repeated here and there. > >>> > >>> is there any other way other than switching to Jinja to get some sort > >>> of macros in django templates? > >>> > >>> thanks > >>> > >>> papa > >>> > >> signature.asc > >> 1KDownload > >> > > > > > > > > > > > -- Regards, Ben Ford [EMAIL PROTECTED] +447503145951 --~--~-~--~~~---~--~~ 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 media project
Am Dienstag, 22. Januar 2008 07:31 schrieb Chris: > Hello I just opened a new project on google code and I was wondering > if there was anyone that would be willing to help me work on this > project in their free time. Check it out. http://code.google.com/p/megal/ > Please give me feed back too. Hope I am not violating any rules by > posting this here. It is a django based project. Thanks. No, AFAIK you don't violate any posting rules. But an announce email should contain all needed information. Following the links should be optional. Thomas --~--~-~--~~~---~--~~ 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: considering django for The Freesound Project, some (de)constructive critisism
> 2. file uploads are the most vital part of freesound. While I have used > tramline successfully with splice, it still feels like a relatively ugly > solution to me (especially as you need to patch mod_python in order for > it to work). As far as I know streaming file uploads have been on the > todo for more than a year. This is not about streaming, but maybe it helps someone : I had trouble with FileField, too. But then I realized, that I don't need it. What does it offer? Only the filename is stored in the database. If you want to store N files for an object, you need to create a new table/model. I use this: Every object has a corresponding directory in the filesystem: .../files/OBJECT-ID/ I store the files there. The filename get's quoted with django.utils.http.urlquote() this way the filenames contain only ascii characters. Thomas --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Accessing individual radio buttons from a template
I'd like to be able access the individual radio buttons of a ChoiceField using the RadioSelect widget directly from a template. After quite a bit of searching, I don't think this is currently possible with newforms but I was wondering if anyone knows of something I missed. An earlier workaround ([1], [2]) doesn't seem to work any longer since as_widget() appears to return a string. (Based on the workaround I presume as_widget() used to return an iterable object.) Any advice would be very much appreciated. Thanks. - whiteinge .. [1] http://groups.google.com/group/django-users/browse_thread/thread/df7e0410fc27f988/9ab6ead8395783bc .. [2] http://groups.google.com/group/django-users/browse_thread/thread/c505f2b9e9c82881/6108563b8df4a4fb .. [3] http://groups.google.com/group/django-developers/browse_thread/thread/d098b7b40a977ea3/566ab80fc286e053 --~--~-~--~~~---~--~~ 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: differences between runserver and apache
On Jan 22, 6:18 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: > Carl Karsten wrote: > > symlinks. I use them. I bet the default is for Apache not to follow them. > > that > > could be my problem. or at least one of them. > > > That is enough to start a wiki page. > > > I am going to divide it into rumors and confirmed rumors. Anyone have some > > rumors for me to post? > > If so, please dump them here. > > http://code.djangoproject.com/wiki/devserver_and_apache_differences The differences have been dealt with before. See: http://groups.google.com/group/django-users/browse_frm/thread/24deb095a2b2e450/f8e703bbb96e9e88?lnk=gst=Graham+setup_environ+PythonPath#f8e703bbb96e9e88 Your page is just making things more confusing. The dev server has nothing to do with PythonPath, you probably mean sys.path, but it is more complicated that you know as explained in referenced post. Also, whether Apache follows symlinks has got nothing to do with it. That aspect of Apache only comes into play when serving static files or you have script files in the directories directly served by Apache, neither of which apply to Django unless you so happen to have also configured Apache to serve up the Django media files which your configuration does not show you are doing. If you want a list of the things that can come up when using Apache, you are better off reading: http://code.google.com/p/modwsgi/wiki/ApplicationIssues This is for mod_wsgi, but lots of the issues such as file access permissions etc etc, also apply to mod_python. You may also want to read: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango which explicitly mentions the need to add both the site and site parent directory to sys.path (through whatever means), if you reference stuff not through the site name. Graham --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Accessor clashes related field
# core/models.py from django.db import models from django.contrib.auth.models import User import ridgemoor.msg.models from time import strftime class Message(models.Model): to = models.ForeignKey(User, related_name = "messages_received") sender = models.ForeignKey(User, related_name = "messages_sent") subject = models.CharField(max_length=50, blank=False) sent = models.DateTimeField(auto_now_add=True) recieved = models.DateTimeField(null=True) body = models.TextField() status = models.CharField(max_length=1, blank=True, null=True) def __str__(self): return self.subject class Admin: list_display = ('sent', 'to', 'sender', 'subject') [EMAIL PROTECTED]:~/ridgemoor$ PYTHONPATH=$HOME ./manage.py syncdb Error: One or more models did not validate: core.message: Accessor for field 'to' clashes with related field 'User.messages_received'. Add a related_name argument to the definition for 'to'. Something broke my app. it is most likely the changes I have been making to get things working under apache, but this may be a change to trunk. It is telling me to add something that is already there. Carl K --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---