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):
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
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)
>
>
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.
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
> 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
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:
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:
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):
>
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 =
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 =
11 matches
Mail list logo