Re: Use object (User and custom object) in a form

2011-08-16 Thread Tom Evans
On Tue, Aug 16, 2011 at 12:39 PM, nicolas HERSOG wrote: > Oh I see, > I've just modified my code with new import but i still have problem to > submit my form. I don t have any errors but i can't pass the > form.is_valid(). > It's my first form so i don t know how to do it. Can you (again) help me

Re: Use object (User and custom object) in a form

2011-08-16 Thread nicolas HERSOG
Oh I see, I've just modified my code with new import but i still have problem to submit my form. I don t have any errors but i can't pass the form.is_valid(). It's my first form so i don t know how to do it. Can you (again) help me ? Here it's my forms.py : from django import forms from django.c

Re: Use object (User and custom object) in a form

2011-08-12 Thread Landy Chapman
copy/paste typo, sorry. It should have read/been: def formView(request, which_form=None): if request.method == 'POST': if not [1, 2].__contains__(which_form): pass # <--- iNone or nvalid form specified else: if which_form==1: form =

Re: Use object (User and custom object) in a form

2011-08-12 Thread Landy Chapman
I apologize since I tried to reply via gmail. Reposting & expanding part of a solution . > I've figured a way that I think will work best for me for the model > and form but I'm having trouble with writing the view. Here is my > pseudo code > > models.py > - > class baseM

Re: Use object (User and custom object) in a form

2011-08-12 Thread Landy Chapman
I think you have a *namespace* problem. > and finally my forms.py : > >from django import forms >from django.contrib.auth.models import User > > > Error was: 'module' object > > has no attribute 'User' #-- You are importing everything in "django/forms/" into yo

Re: Use object (User and custom object) in a form

2011-08-12 Thread Landy Chapman
> class CommentForms (forms.Form): > cf_writer = forms.User() > > Error was: 'module' object > has no attribute 'User' > > Do you have any idea ? Normal forms don't include/automatically create 'User' as a field... The built-in comment app may be what you need: https://docs.djangoproject.com/

Re: Use object (User and custom object) in a form

2011-08-12 Thread bruno desthuilliers
On Aug 12, 10:37 am, Suprnaturall wrote: > > from django.contrib.auth.models import User > > class CommentForms (forms.Form): >     cf_writer = forms.User() > > Error was: 'module' object > has no attribute 'User' > > Do you have any idea ? cf above... -- You received this message because you a

Re: Use object (User and custom object) in a form

2011-08-12 Thread nicolas HERSOG
Humm, maybe you should right, here is my views.py : from django.template import Context, loader, RequestContext from myApp.models import Article, Commentaire from django.http import HttpResponse from django.contrib import auth from django.contrib.auth import authenticate, login, logout from django

Re: Use object (User and custom object) in a form

2011-08-12 Thread Daniel Roseman
Your error has nothing to do with your form. There is an import problem in your empireFront.views module which is preventing it from being imported. Somewhere you are trying to import something called "User" from a place that doesn't have any such class. It would help if you posted the imports i

Re: Use object (User and custom object) in a form

2011-08-12 Thread nicolas HERSOG
Hi everyone, I tried few thigs more but it s still don't work. this is my new template : {% csrf_token %} And my view : def vod(request, id): article = Article.objects.get(id=id) commentaires = Commentaire.objects.filter(article=article.id ).order_by("-dateComment") c = Context({ 'article'