Friday, June 26, 2020

Re: I have posted my question in stackoverflow


Hi,

I'm not sure about what you are expecting from your template "home.html"
but as it is rendered from your view "home(request)", the data passed came from the user instance that is logged-in (cf the decorator '@login_required') as it is explained here (https://docs.djangoproject.com/en/2.2/ref/templates/api/#django-contrib-auth-context-processors-auth)
This instance seems to be defined from the default user model (cf "from django.contrib.auth.models import User")
in that case your custom fields "Business_name" and "mobile" are not defined in the default user model
if you want such fields pleaseyou will need to extend this model cf https://docs.djangoproject.com/fr/2.2/topics/auth/customizing/#extending-the-existing-user-model
```
    >home.html
    {% block content %}
        <p> {{ user.Business_name }} {{ user.first_name}} {{ user.last_name}} {{ user.email }} {{user.username}} {{ user.mobile }} </p>
    {% end block %}
 ```
Also in your stackoverflow message you show this UserCreationForm
If you actually want to use it in a template you actually need more work cf this quick note in this section: https://docs.djangoproject.com/fr/2.2/topics/forms/#working-with-forms

PS: keep your field name "Business_name" in it's lower case form 'buisness_name' as it's a variable and not a class

Hope this gave you some help

Cheers

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6d5193b2-4e39-4143-ba8c-b05020bebd51n%40googlegroups.com.

No comments:

Post a Comment