Permissions broken

2007-11-15 Thread sorrison
HI, Permissions in django.contrib.auth seem to be broken for me. I am using the svn trunk version. It seems to have been like this for a while. In [21]: p = Permission.objects.get(codename='add_person') In [22]: p.user_set.all() Out[22]: [] In [23]: user = p.user_set.all()[0] In [24]: user.ge

Dynamic ModelChoiceField

2007-05-31 Thread sorrison
I am using a ModelChoiceField (default_project) in a form and want the initial queyset to change when the form is created. I've tried doing it like this: forms.py -- class UserAccountForm(forms.Form): . default_project = forms.ModelChoiceField(queryset=Project.objects.all(), requir

RadioSelect attrs

2007-03-08 Thread sorrison
I am working with newforms and am wanting to set the class of the produced with a ChoiceField using a RadioSelect widget. I assume it should be something like this.. field = forms.ChoiceField(choices=CHOICES, widget=forms.RadioSelect(attrs={'class': 'fun'})) output would be Field: Choice

auto total field

2006-11-18 Thread sorrison
I am in the process of developing a stock ordering system. I want the total field to be automatically calculated by quantity and price fields when i try and save an order item (in the admin interface) it says please correct the errors below without highlighting any of the fields. This is what i

Re: Drop down not displaying foreign key values

2006-11-13 Thread sorrison
Hi Jeff, You'll need to add a __str__ method to your Status class as since it doesn't have one it is only returning the object. If your familiar with java its like a toString() method class Status(models.Model): Status = models.CharField(maxlength=50) def __str__(self): return sel

Re: Apache 2.0.58 will not OBEY on OS X 10.4.8

2006-11-09 Thread sorrison
Hi again, Firstly i would turn PythonDebug On, Here is a sample of what i use in a production enviroment maybe this might help. Cheers, Sam SetHandler mod_python PythonHandler django.core.handlers.modpython PythonPath "['/path/to/python/code'] + sys.path" SetE

get_FOO_display for a grouper

2006-11-08 Thread sorrison
I have a class with a "site" field that uses choices I want to display the human readable name for it when being used as a grouper i thought something like site.get_grouper_display or get_site.grouper_display but that doesn't work here is the template code {% regroup object_list|dictsort:"grou

Re: Apache 2.0.58 will not OBEY on OS X 10.4.8

2006-11-08 Thread sorrison
Can you tell us what your apache logs say? hard to tell what is going on. In the directory templates do you have your python code? The way you've got it apache is expecting your settings file to be /Users/kimvandenbroek/Sites/templates/mysite/settings.py is that where it is? Cheers, Sam On

Re: Templates and Views - what counts as "logic"?

2006-10-30 Thread sorrison
I had this proble too. Heres how i solved it. First i had a model method: def get_wordcount(self): return len(self.content.split()) (content is a TextField) Then in my template i used it like this: {{ object.content|truncatewords:60 }} {% load base_utils %} {% ifg