Saturday, November 18, 2017

Re: reg:not able to open registration form web page

Hello Mike, 

Thank you for your reply again. And I have already gone through the link. I am looking for exact code that I am supposed to write inside my 2nd "if" condition, as may be I am not able to understand the logic. Django docs have lots of information, which is creating confusion to me. The latest link that you have shared, it was helpful to some extent, and because of that I have progressed till now. But its a dead lock for me now. So, as I said, I need exact code that I am supposed to mention 

Hello,

Regards,
Amitesh Sahay

primary :: 91-907 529 6235



On Saturday 18 November 2017, 4:26:37 AM IST, Mike Dewhirst <miked@dewhirst.com.au> wrote:


Amitesh

I found this helpful ...

https://simpleisbetterthancomplex.com/tutorial/2017/02/18/how-to-create-user-sign-up-view.html

Cheers

Mike


On 17/11/2017 10:07 PM, 'Amitesh Sahay' via Django users wrote:
> Hello James,
>
> Thanks a lot for reply. There are couple of things that I would like
> to bring to the notice
>
> 1) I did go through that part of django document before posting the
> issue here.
> 2) In that doc, in the 2nd "if" condition, its talking about
> cleaned_data. In one of the public forum, I was asked to remove that
> part from my views.py, as I am not customizing my models.py. If I use
> cleaned_data. I entered the below in my earlier view.py
>
>             #username = form.cleaned_data.get('username')
>             #password = form.cleaned_data.get('password')
>             #email = form.cleaned_data.get('email')
>             #user.save()
>
> Please let me know if that was right? Also, can you point me to the
> exact changes that you want me to make in my views.py. I am sorry that
> I am asking this, but over the last 2 week or so, I am so frustrated
> that I am not able to think much on this part.
>
>
> Hello,
>
> Regards,
> Amitesh Sahay
>
> primary :: *91-907 529 6235*
>
>
>
> On Friday 17 November 2017, 12:04:25 PM IST, James Schneider
> <jrschneider83@gmail.com> wrote:
>
>
>
>
> On Nov 15, 2017 8:32 AM, "'Amitesh Sahay' via Django users"
> <django-users@googlegroups.com <mailto:django-users@googlegroups.com>
> > wrote:
>
>    Hello Members,
>
>    I am new to Django, and trying to create a mock Django
>    registration page. I am using default Django "User" model to do
>    that, and I am not customizing anything. Its a very simple form
>    with 3 fields as follows:
>
>    'username','password','email'. Below are my python and html code
>    details:
>
>
> Snip...
>
>    views.py
>    --------
>
>    def SignUpFormView(request):
>        user_form = 'SignUpForm'
>
>        template_name = 'test.html'
>
>        if request.method == 'POST':
>            form = user_form(request.POST)
>            if form.is_valid():
>                form.save()
>                #username = form.cleaned_data.get('usernam e')
>                #password = form.cleaned_data.get('passwor d')
>                #email = form.cleaned_data.get('email')
>                #user.save()
>                return render(request, template_name, {'form':form})
>
>
>        else:
>            SignUpForm()
>
>        return render(request, 'user_info/about.html')
>
>
> Snip...
>
>    My issue is, when trying to launch the "register" page, its not
>    going inside "if" condition in views.py, rather its going directly
>    to "else" condition.
>
>    I am tried many things under my reach, but couldn't resolve the
>    issue, and stuck for 2 weeks now.
>    Any help would be appreciated.
>
>
> There are several issues with the view composition. Please refer to
> the docs here and verify your syntax matches the example:
>
> https://docs.djangoproject.com/en/1.11/topics/forms/#the-view
>
> Your template code also suggests that you are seeing duplicate form
> fields (or perhaps they are being rendered in the source but aren't
> visible). It's also possible that the Django form is not being created
> correctly in the first place, which is why you need to manually render
> the form fields, when the {{ form.as_p }} should be doing that for you.
>
> If you are submitting the form and getting the behavior you describe,
> I'm guessing that the if statement isn't being skipped, but the values
> being submitted do not match the form object in Django, causing it to
> fail validation, meaning that the second if statement is coming back
> False.
>
> -James
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWNrWLhEzhM6649BsP5JByUXbsS7gvBVaKq2BkejKH7Rw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWNrWLhEzhM6649BsP5JByUXbsS7gvBVaKq2BkejKH7Rw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout
> .
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1670974142.510163.1510916854178%40mail.yahoo.com
> <https://groups.google.com/d/msgid/django-users/1670974142.510163.1510916854178%40mail.yahoo.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e04f595b-f2e7-368a-d3c6-b01dac9ea0c9%40dewhirst.com.au.

For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment