Problem with 'ModelForm' vs 'Permission'

2013-02-28 Thread Bino Oetomo
Dear All. I've something like this : START- class L2GroupForm(ModelForm): #Try to lock ForeignKey field to single value class Meta: model = L2Group widgets = { 'company_id': TextInput(), } class L2GroupAdmin(admin.ModelAdmin):

Re: Some problem with modelform save

2011-01-03 Thread robos85
THANKS. I overlooked it. To work around this problem, every time you save a form using commit=False, Django adds a save_m2m() method to yourModelForm subclass. After you've manually saved the instance produced by the form, you can invoke save_m2m() to save the many-to-many form data. -- You

Re: Some problem with modelform save

2011-01-03 Thread Daniel Roseman
On Monday, January 3, 2011 9:25:00 PM UTC, robos85 wrote: > > I use modelform. All works fine. Validation is ok and I want to save my > form. Before saving I need to populate user_id into my modelform so i make > something like this: > if form.is_valid(): > > obj = form.save(commit=False) > >

Some problem with modelform save

2011-01-03 Thread robos85
I use modelform. All works fine. Validation is ok and I want to save my form. Before saving I need to populate user_id into my modelform so i make something like this: if form.is_valid(): obj = form.save(commit=False) obj.user = request.user obj.save() It seems to be ok.

Re: Problem with ModelForm

2010-09-04 Thread Kenneth Gonsalves
On Sat, 2010-09-04 at 09:19 -0700, Jagdeep Singh Malhi wrote: > form = Input(request.POST) form = InputForm(request.POST) -- regards Kenneth Gonsalves -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Problem with ModelForm

2010-09-04 Thread Jagdeep Singh Malhi
> Fairly obviously, you've instantiated the model - Input() - rather > than the form - InputForm() - in both branches of the if statement of > your view. it works. Thanks Sir. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Problem with ModelForm

2010-09-04 Thread Daniel Roseman
On Sep 4, 5:19 pm, Jagdeep Singh Malhi wrote: > I try to Create forms from models > I am facing error message with 'is_valid()' > > error is  : > { > AttributeError at /add_db/ > > 'Input' object has no attribute 'is_valid' > > Request Method:         POST > Request URL:  

Problem with ModelForm

2010-09-04 Thread Jagdeep Singh Malhi
I try to Create forms from models I am facing error message with 'is_valid()' error is : { AttributeError at /add_db/ 'Input' object has no attribute 'is_valid' Request Method: POST Request URL:http://localhost/django/add_db/ Django Version: 1.2.1 Exception Type:

Re: newbie problem with ModelForm

2009-12-08 Thread Karen Tracey
On Fri, Dec 4, 2009 at 6:04 AM, Andreas Kuntzagk < andreas.kuntz...@mdc-berlin.de> wrote: > Hi, > > have a (probably simple) problem using ModelForms. I'm following this > guide: > http://docs.djangoproject.com/en/1.0/topics/forms/modelforms/ > > Here are my models: > > class Run(models.Model): >

newbie problem with ModelForm

2009-12-04 Thread Andreas Kuntzagk
Hi, have a (probably simple) problem using ModelForms. I'm following this guide: http://docs.djangoproject.com/en/1.0/topics/forms/modelforms/ Here are my models: class Run(models.Model): name = models.CharField(max_length=200) class RunForm(ModelForm): class Meta: model =

Problem with ModelForm

2009-11-22 Thread jorge
hi i have a problem when i try to render my form without information . so my code is : models.py class Obra(models.Model): cod_obra= models.CharField("código da obra",max_length=15,primary_key=True) nome_da_empreitada= models.CharField(max_length=100) data_de_incio =