Re: How to know if is a update or insert??

2011-02-07 Thread andmart
Marc, I found a reference in docs. http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#modeladmin-methods On Feb 6, 2:00 pm, Marc Aymerich <glicer...@gmail.com> wrote: > On Sun, Feb 6, 2011 at 2:53 PM, andmart <andm...@gmail.com> wrote: > > In a insert or in a upda

Re: How to know if is a update or insert??

2011-02-06 Thread andmart
<glicer...@gmail.com> wrote: > On Fri, Feb 4, 2011 at 10:13 PM, andmart <andm...@gmail.com> wrote: > > Hi, > > > I overrided the save_model of ModelAdmin of model Client that is > > associated a one User so I can create a user when a client is created. >

How to know if is a update or insert??

2011-02-04 Thread andmart
Hi, I overrided the save_model of ModelAdmin of model Client that is associated a one User so I can create a user when a client is created. Well, how to know if the save_model was called to do a update or a insert if the object already exists in database? Trying to see if model.pk exists fail.

Re: Add/Remove fields in ModelForm in Admin site

2011-02-02 Thread andmart
'] del self.base_fields['item'] else: self.fields['item'] = forms.CharField(label='Item') self.base_fields['item'] = forms.CharField(label='Item') On 1 fev, 19:13, andmart <andm...@gmail.com> wrote: > There is an error in code above. > > I

Re: Add/Remove fields in ModelForm in Admin site

2011-02-01 Thread andmart
There is an error in code above. I forgot to write to message the call to super. Here is the code I'm trying to work http://dpaste.com/375663/ Thanks in advance for any help On 1 fev, 17:48, andmart <andm...@gmail.com> wrote: > Hi all, > > I'm trying to remove or add fields ba

Add/Remove fields in ModelForm in Admin site

2011-02-01 Thread andmart
Hi all, I'm trying to remove or add fields based in presence of 'instance' parameter in ModelForm __init__ like this: class ItemForm(ModelForm): class Meta: model = Item def __init__(self, *args, **kwargs): if not kwargs.has_key('instance'):

AttributeError - Accessing form attribute

2008-08-21 Thread andmart
Hi, I´m working with django 0.96.2 and have a form called LoginForm as below: #file formularios.py from django import newforms as forms class LoginForm(forms.Form): email = forms.CharField(max_length=100 ) senha = forms.CharField(widget = forms.widgets.PasswordInput) url_back =