Re: ModelForm removing blank=True

2008-12-09 Thread tenni
Brilliant. Thanks James. I went down this path of thinking but tried blank=True instead of required=False which, when it failed, confused my underslept mind :) Appreciate it. Andrew. On Dec 10, 1:03 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Tue, Dec 9, 2008 at 7:5

ModelForm removing blank=True

2008-12-09 Thread tenni
If I do this in admin.py class UnitAdminModelForm(forms.ModelForm): optional_field = forms.CharField(widget=WYMEditor()) class Meta: model = Unit "optional_field" becomes a required field in the Admin. I assume something is overriding the model's blank=True for this field. If i

Any ideas why this code won't work in a post save signal, but will in the shell?

2008-12-03 Thread tenni
def post_save_user_handler(sender, **kwargs): user = kwargs['instance'] if user.is_staff: # only give add_staffprofile permissions to staff p_add_perm = Permission.objects.get (codename='add_staffprofile') p_change_perm = Permission.objects.get (codename='change_st

Limiting a ForeignKey when using ModelForm

2008-10-20 Thread tenni
I have a ModelForm: RequestForExtensionForm which is built from a model: RequestForExtension Basic stuff so far... The RequestForExtension model has a ForeignKey to the Unit model (Unit is a study course offered that a student can request an extension on via this form) My problem is that in Un

Newforms-admin - Problem prepopulating an inline slug field

2008-04-21 Thread tenni
I'm trying to prepopulate a slug field with newforms-admin. It works fine for the 'normal' Article model, but the inline Photo model's slug field won't prepopulate from it's title field. (If the code below doesn't make sense, I can paste the whole model.) Two models: Article and Photo in the same

[Newforms-admin] Prepopulating a slug field in an inline

2008-04-21 Thread tenni
I'm trying to prepopulate a slug field with newforms-admin. It works fine for the 'normal' Article model, but the inline Photo model's slug field won't prepopulate from it's title field. (If the code below doesn't make sense, I can paste the whole model.) Two models: Article and Photo in the same

Re: (newbie) Can I filter by the fields of a ForeignKey when making a QuerySet?

2007-12-04 Thread tenni
Ha ha! It works!! This is exactly what I was trying to get at! Thanks a lot Karen. ...funny thing is I had a browser tab open on that very docs page! Concentration levels must be dropping off... time for food. --~--~-~--~~~---~--~~ You received this message becaus

(newbie) Can I filter by the fields of a ForeignKey when making a QuerySet?

2007-12-04 Thread tenni
Apologies if this is obvious. I'm still coming to grips with Views in general... I want to get a QuerySet of Items filtered by their ProductType for use in a template. [Model below] I want to display a page of all the Items of a given ProductType. ie. all the different versions (Items) of Roadcas