Re: A model's property in a form?

2010-02-18 Thread Boris Schaeling
On Thu, 18 Feb 2010 17:13:09 +0100, Boris Schaeling wrote: [...]I see. Then it means what I actually tried to do is impossible. I can't use properties as described at http://www.djangoproject.com/documentation/models/properties/ but should overwrite save() and __init__() because

Re: A model's property in a form?

2010-02-18 Thread Boris Schaeling
On Thu, 18 Feb 2010 16:53:06 +0100, Gonzalo Delgado wrote: El 18/02/10 10:18, Boris Schaeling escribió: This replaces the setter but not the getter. To replace the getter, you'd have to override the modelform's __init__ method and set the corresponding field value from th

Re: A model's property in a form?

2010-02-18 Thread Boris Schaeling
On Thu, 18 Feb 2010 02:01:16 +0100, Sam Lai wrote: On 18 February 2010 10:49, Boris Schaeling wrote: Is it possible to make a model's properties available in a form which are created as described at http://www.djangoproject.com/documentation/models/properties/? [...] Not impossible -

A model's property in a form?

2010-02-17 Thread Boris Schaeling
Is it possible to make a model's properties available in a form which are created as described at http://www.djangoproject.com/documentation/models/properties/? For example the following model form does not display any widgets for full_name and full_name2: class PersonForm(forms.ModelForm

Shortcut to create and update a model object?

2009-11-22 Thread Boris Schaeling
Is there a shortcut to create and update a model object from a form? For example I'd like to write something like: MyModel.objects.create(mymodel_form.cleaned_data) or model_obj = get_object_or_404(MyModel, pk=id) model_obj.update(mymodel_form.cleaned_data) Not setting attributes individually