Re: django.contrib.auth.views.login customization

2011-02-16 Thread Dean Chester
I would write my own login controller using the Authentication and Login 
methods. Check out this part of the django docs: 
http://docs.djangoproject.com/en/1.2/topics/auth/#how-to-log-a-user-in

Dean 
On 16 Feb 2011, at 13:51, galago wrote:

> Is it possible, to add some extra validation checks into 
> django.contrib.auth.views.login?
> I need to check some fields from UserProfile to login
> 
> -- 
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django Form Doesn't Render

2011-02-14 Thread Dean Chester
Hi,
I have written a form in forms.py that looks like this:
class ContractForm(forms.Form):
title = forms.CharField()
start_date = forms.DateField()
end_date = forms.DateField()
description = forms.CharField(widget=forms.Textarea)
client = forms.ModelChoiceField(queryset=Client.objects.all())

And in my view (yes i know there are problems with data not being
checked but the aim was to get the client field to display clients
associated with that user):
def addContractTEST(request):
if request.method == 'POST':
contractForm = ContractForm(request.POST)
title = request.POST['title']
start_date = request.POST['start_date']
end_date = request.POST['end_date']
description = request.POST['description']
client = request.POST['client']
user = request.user
contract =
Contract(title,start_date,end_date,description,client,user)
contract.save()
return HttpResponseRedirect('../../accounts/profile/')
else:
user = request.user
print user.username
contractForm = ContractForm()
return render_to_response('newcontract.html', {'ContractForm':
ContractForm})

And my newcontract.html:

 


{% if contractForm.errors %}

Please correct the error{{ contractForm.errors|pluralize }} 
below.

{% endif %}


{{ contractForm.as_p }}



  

But all that appears is my submit button so what am I doing wrong?

Thanks in Advance,
Dean

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.