I am pretty new to Django - new enough to be developing my first Django app 
on 1.3. So, I am basing all my work on class-based generic views, and have 
never used the older generic view functions.

A problem I have is the lack of examples and documentation on the new 
class-based generic views.

My current problem is that I am trying to build some forms based on models. 
I am not using Django Forms (ModelForm), but rather CreateView. CreateView 
gets me almost there, but I can't find any documentation on (1) how to 
exclude fields, and (2) how to fix a value for a field.

My class is like so:

class CreateCampaignView(CreateView):
model = Campaign
template_name = "forms/create.html"

I tried exclude from ModelForms, like this:

class CreateCampaignView(UserAccountCreateView):
model = Campaign
template_name = "forms/create.html"
        exclude = ('user', 'name', 'content_inlined')

and that doesn't work. Is there another way to exclude fields using 
CreateView?

and, one of my excluded fields, "user", also needs to get the value of 
self.request.user

I tried again here to apply the docs from ModelForms here for CreateView, 
but it doesn't work.


Some might suggest I use Django Forms - it is a reasonable suggestion of 
course. But, being new, I don't have any "view legacy" and I just like the 
idea of working with class-based generic views where possible.

thanks.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/g4ADYoJAbE0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to