Re: uneditable fields

2009-05-14 Thread Rama Vadakattu
So you need dynamic form as below Class MyForm(forms.ModelForm): fields ... def __init__(self, user,*args , **kwargs): super(MyForm,self).__init__(*args,**kwargs) if user is not superuser :

uneditable fields

2009-05-14 Thread duikboot
Hi, is there a way to have a field editable by the superuser but not by another logged in user, in the admin area? The rest of the model should be editable by the logged in user. example: class Test(models.Model): title = models.CharField(max_length=150) page = models.TextField() So pag

Re: Creating a Form with some uneditable fields

2007-10-02 Thread Simone Cittadini
Was a "look all the fields type before asking problem" ... I've solved with HiddenField and disabled option ... class RuoteForm(forms.Form): line_name = forms.ChoiceField(choices=get_lines(), widget=forms.HiddenInput) prefix = forms.ChoiceField(choices=get_prefixes(), widget=forms.Hidde

Re: Creating a Form with some uneditable fields

2007-09-20 Thread Richard Dahl
Off the top of my head, not necessarily the cleanest way of doing this but it should work. Pass the request.user as user if this is the user that the form is for: i.e. return (render_to_response('form_template', {'user': request.user, 'form': form}) the template could then look something l

Creating a Form with some uneditable fields

2007-09-20 Thread Simone Cittadini
I have some models like : class UserOfSomeStuff(models.Model): [...] class AvailableStuffToUse(models.Model): [...] class CurrentlyUsedStuff(models.Model): user = models.ForeignKey(UserOfSomeStuff) used_stuff = models.ForeignKey(AvailableStuffToUse) In my application I don't n