Re: generic views and form templates

2007-11-21 Thread Martin
hi, michael thanks for the help.. i've tried this but it still doesn't work. i'm doing something wrong, but i don't know what. if i remove save(), object still gets created, just without slug. my question here is: does slug field needs to have blank=True? when that is set, object gets created, wi

Re: generic views and form templates

2007-11-21 Thread Michael
Hi Martin, On Nov 22, 7:59 am, Martin <[EMAIL PROTECTED]> wrote: > i wrote this at the end of my model (for which, slug must be created > after user creates it): > > def save(self): > if not self.id: > self.slug = title.slugify() > super(Kom

Re: generic views and form templates

2007-11-21 Thread Martin
btw, after this change, object gets created, but the slug field is empty.. so i can't view the object, because of (r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(? P[-\w]+)/$',object_detail, dict(komentar_date_dict, slug_field='slug')) thanks, martin --~--~-~--~~~---

Re: generic views and form templates

2007-11-21 Thread Martin
Thanks a lot, guys! i'm pretty new to django and i really didn't want to use newforms in my app. but RajeshD's idea is pretty cool. it just seems that i don't know how to use slugify().. if you have just a little more time, please help me for a minute: i wrote this at the end of my model (for w

Re: generic views and form templates

2007-11-21 Thread Michael
Hi Martin, Looking at your url conf above, I'm thinking that you're not currently using a form for your templates? I'd create a form (newform) for your model and then use this to ensure that entry of the slug field is not required [1] by the user when creating a post, and then update your form's

Re: generic views and form templates

2007-11-21 Thread RajeshD
> that work ok, when a user want to create an entry it opens > komentar_form.html and it's displayed right. but when user clicks > submit, it always returns a error for slug field. since user doesn't > write slug field (should be prepopulated, right?), No. That only happens in the admin and even

Re: generic views and form templates

2007-11-21 Thread Martin
ok, i'll rephrase this all.. i'm using django.views.generic.create_update.create_object to create an object, which has a slug field. i wrote custom template for creating objects. everytime i want to create an object i get an error, that the object with this title (or slug) already exists in my db

generic views and form templates

2007-11-21 Thread Martin
hi, i'm having a little trouble with templates for my app. here is the problem: i have title, slug and body field for my model blog. i would like other users to create blog entries, so i've used generic views and put this in my urls.py: (r'^edit/(?P\d+)/$', update_object, dict(model=Komentar,