Hi Ramdas,
the "Right Way (tm)" how to solve this using newforms is:
1) subclass Field to create a field representing (and validating) username:
class UserField( forms.Field ):
def clean( self, value ):
do what you must to verify username, throw validation error if you
are not satisfied with the data
2) create the Form:
class RegistrationForm(forms.Form):
username = UserField()
passwd = forms.CharField( widget=forms.PasswordInput, max_length=121 )
email = forms.EmailField(......
3) create the view (and urls.py entry for it):
def register( request ):
form = RegistrationForm( request.POST )
if form.is_valid():
data = form.clean_data
hoooray, we have valid entry, do what you must
return httpResponseRedirect('/')
return render_to_response( "register.html", { 'form' : form } )
4) create the template
<form action="." method="POST">
<table>
{{ form }}
<tr><td colspan="2"><input type="submit" /></td></tr>
</table>
</form>
5) enjoy
hope this helps...
Honza
On 1/4/07, Ramdas S <[EMAIL PROTECTED]> wrote:
I am trying to move a user registration form code inspired heavily from
http://www.b-list.org/weblog/2006/09/02/django-tips-user-registration
to newforms from oldforms.
Does the newforms replace django.core.manipulators, if so how can I use it?
To save data using a form, how else can I use the newforms without using
manipulators
Advice appreciated
Ramdas
>
--
Honza Kr l
E-Mail: [EMAIL PROTECTED]
ICQ#: 107471613
Phone: +420 606 678585
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---