On 11/11/2019 7:02 am, Alexander Beach wrote:
I am trying to create registration forms using Django's built in auth forms.  However, when using the Django admin, the Django admin templates are always being used.

My application structure is as follows:

|
├──bug
│├──__init__.py
│├──__pycache__
│├──settings.py
│├──urls.py
│└──wsgi.py
├──db.sqlite3
├──manage.py
└──mysite
├──admin.py
├──apps.py
├──__init__.py
├──migrations
│└──__init__.py
├──models.py
├──registration
├──templates
|
| mysite/templates/admin/password_reset_form.html

Not tested but that's the principle. Django will default to using the template from your site rather than its own. The admin is one of your apps so it will use any templates it finds (that urls.conf knows about) in your main templates directory.

Cheers

Mike

|
|
│└──registration
│└──password_reset_form.html
├──tests.py
└──views.py

|


My urls.py is the following:


|
fromdjango.contrib importadmin
fromdjango.conf.urls importinclude,url
fromdjango.urls importpath


urlpatterns =[
    path('admin/',admin.site.urls),
    url(r'^accounts/',include('django.contrib.auth.urls'),name="auth"),
]

|


The mysite/templates/registration/password_reset_form.html is not being rendered.  When I navigate to localhost:8000/accounts/password_reset, i can see that its using the Django Admin template. See attached screenshot.  I am expecting my custom template for the reset form to be rendered.

I am using Django version 2.2.5 and python 3.7.3

Is this a bug or the expected behavior? I don't want to remove the admin app.




--
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+unsubscr...@googlegroups.com <mailto:django-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c718299d-53f6-4e56-8976-a2040f3449ac%40googlegroups.com <https://groups.google.com/d/msgid/django-users/c718299d-53f6-4e56-8976-a2040f3449ac%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2e77a76e-e6a5-392c-acd9-4694e260a42e%40dewhirst.com.au.

Reply via email to