Adding fields to form.clean_data

2007-07-30 Thread ilDave
Hello! I have a form generated with form_for_model. I deleted a couple of fields from it, beacuse I don't want the user to insert value for them, but their value should be automatically filled after the submit of the form. So, I have something like this: MyForm = form_for_model(myModel) del

Re: Adding fields to form.clean_data

2007-07-30 Thread ilDave
it=False) > instance.attribute=... > instance.save() > > BTW: the "commit" keywords does not mean database commit. > If means, don't call save() of the instance. > > Am Montag, 30. Juli 2007 14:54 schrieb ilDave: > > > Hello! > > I have a form generated with fo

Problem with __setattr__ and __getattribute__

2007-08-01 Thread ilDave
Hello. I have a view that should duplicate a model object and save it in the database. I tried with this code: obj = MyModel.objects.get(pk=1) obj2 = MyModel() for e in obj.__dict__: if e != 'id': obj2.__setattr__(e, obj.__getattribute__(e)) #error obj2.save() But I get this

Extending generic views and pagination

2007-05-10 Thread ilDave
Hi all! I'm a new python and django user, and this is my first post in this group! I'm writing a small app that shows a list of objects after a successfull login. I made a custom view to handle authentication and at the same time to keep the semplicity of the generic view

Re: Extending generic views and pagination

2007-05-12 Thread ilDave
Anybody has any suggestion? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to

Re: Extending generic views and pagination

2007-05-13 Thread ilDave
Thanks for your suggestion, but the problem was in the generated link for the pagination: they pointed to '?page=X/' instead of '?page=X'. I removed the ending slash and everything now works fine! --~--~-~--~~~---~--~~ You received this message because you are

Re: ImportError: No module named mysite.settings

2007-05-14 Thread ilDave
Check the permissions of the directory where your app lives, it has to be readable by the webserver. On May 14, 4:14 pm, Mark Phillips <[EMAIL PROTECTED]> wrote: > On May 14, 2007, at 2:13 AM, Steven Armstrong wrote: > > > > > ... > > PythonPath "['/usr/local'] + sys.path" > >

Settings object has no attribute 'ROOT_URLCONF': what does this message mean?

2007-06-06 Thread ilDave
Hi all, I'm trying to set up a new django app under Apache and mod_python. I created a new project called 'testdrorys', and inside it a new app called 'etichette'. The full path of my project is /var/www/html/testdrorys/testdrorys/myapp The first testdrorys dir is the main directory of the

Re: Settings object has no attribute 'ROOT_URLCONF': what does this message mean?

2007-06-06 Thread ilDave
ote: > On 6/6/07, ilDave <[EMAIL PROTECTED]> wrote: > > > AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF' > > > What's wrong with my configuration? It seem that python can't find the > > urls.py file, but it is in the right place and everything is

Re: Settings object has no attribute 'ROOT_URLCONF': what does this message mean?

2007-06-06 Thread ilDave
That's it! I was going crazy looking inside the settings.py, and the problem was in the httpd.conf, that I assumed was correct :) Thanks a lot! On Jun 6, 5:10 pm, "Deryck Hodge" <[EMAIL PROTECTED]> wrote: > On 6/6/07, ilDave <[EMAIL PROTECTED]> wrote: > >

Problem with query over relationships and the FOO_set Manager

2007-06-25 Thread ilDave
In my app I have two models like this: class Header(models.Model): code = models.CharField() author = models.CharField() class Detail(models.Model) header = models.ForeignKey(Header) creation_date = models.DateTime() I need to find all the Header objects with a certain code, a

Re: Problem with query over relationships and the FOO_set Manager

2007-06-25 Thread ilDave
I tried your second solution and it works fine! Thanks! On Jun 25, 4:51 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > d = Details.objects.filter(creation_date__gte=datetime.date(2007, 06, > > 01)) > > d = d.header_set.filter(code__exact='123', author__exact='dave') > > > but I get an > >

Remove a field from a form

2007-07-09 Thread ilDave
Hi! I have to show two identical forms in a page, so I used form_for_model and I created two form objects. I don't need to show a particular field, so i tried to remove it this way: def showtwoforms(request): PreventivoForm = form_for_model(Preventivo) #'Preventivo' is the model f =

Re: Remove a field from a form

2007-07-09 Thread ilDave
PreventivoForm() > f2 = PreventivoForm(auto_id='id_%s2') > > > Nathan Ostgard > > On Jul 9, 2:33 am, ilDave <[EMAIL PROTECTED]> wrote: > > > Hi! > > I have to show two identical forms in a page, so I used form_for_model > > and I created two for

Re: Remove a field from a form

2007-07-09 Thread ilDave
I read this on the documentation, but I'm usinge the 0.96 versione, non the development one, so I can't use it... But Nathan's method worls well :) On Jul 9, 1:04 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/9/07, ilDave <[EMAIL PROTECTED]> wrote: > &g

Problem with image upload

2007-07-20 Thread ilDave
I've a form that handles file uploading to the database: it works fine, the file is uploaded in the right place and the path is written on the database (I use a models.ImageField field in a model). Than I have another form, that uses newforms, with a field that should be populated with all the

Re: Problem with image upload

2007-07-20 Thread ilDave
_choices=False, label='Pic', required=False) > > On Jul 20, 1:15 am, ilDave <[EMAIL PROTECTED]> wrote: > > > I've a form that handles file uploading to the database: it works > > fine, the file is uploaded in the right place and the path is written > > on th

form_for_model with custom modifications and save()

2007-07-20 Thread ilDave
Hello! I'm using form_for_model to create a form for a particulary complex model. I don't want to show a particular field of the model in the form, so I did this: PreventivoForm = form_for_model(Preventivo) #Preventivo is the name of the model del PreventivoForm.base_fields['codice'] # codice

Re: form_for_model with custom modifications and save()

2007-07-20 Thread ilDave
Ok, I resolved just adding a 'codice' key with the right value to the f.clean_data dict before saving... Is there a better way or can I stay with this? On Jul 20, 4:35 pm, ilDave <[EMAIL PROTECTED]> wrote: > Hello! > I'm using form_for_model to create a form for a particulary com