Re: customization using form_class with generic views

2009-07-26 Thread djangonoob
Hi Hebert, ok thanks i got what u mean. But what happens if my model is now like this: # models.py class Images(models.Model): title = models.CharField(max_length=200) images = models.ImageField(upload_to='userimages') user = models.ForeignKey(User) public = models.BooleanField()

Re: customization using form_class with generic views

2009-07-26 Thread Frédéric Hébert
Hi, AFAICS, it's nearly impossible to do this in the way you want to. set_pub_date is an another view which does a CRUD operation like generic view create_object and you pass it to extra_context which is relevant to a template operation. extra_context declares new objects in the template and i

Re: customization using form_class with generic views

2009-07-26 Thread djangonoob
oh, i missed out my def set_pub_date() in views.py. Here is the revised version of my code: ( link to dpaste is here: http://dpaste.com/71532/ ) #urls.py press_detail_dict = { 'queryset': PressRelease.objects.all(), 'template_name':'press/detail.html', 'template_object_name':'press',

Re: customization using form_class with generic views

2009-07-26 Thread djangonoob
hi Dan, than may i know what is the code like in my views.py for the function set_pub_date? Also, from the urls.py, how do i call the set_pub_date() ? ( in urls/py i am using generic view ) Best Regards. On Jul 26, 12:33 pm, Dan Harris wrote: > Assuming that you set_sub_date() function just

Re: customization using form_class with generic views

2009-07-25 Thread Dan Harris
Assuming that you set_sub_date() function just sets the publish date to when the item was created and easy way to do this is in the model class PressRelease(models.Model): pub_date = models.DateField(auto_now_add=True) That will just set the pub_date to the current date when it is added to t

customization using form_class with generic views

2009-07-25 Thread djangonoob
I would like to use Django's generic views for create, update, delete operations. However, i am start with the first step: the create operation. What i want to do is to use the django.views.generic.create_update.create_object function, using the form_class as the required arguments. I would like