talkpython / 100daysofweb-with-python-course

Demo code and resources for our 100 Days of Web in Python Course
https://training.talkpython.fm/courses/explore_100days_web/100-days-of-web-in-python
630 stars 391 forks source link

Day 53 - 56: Django registration_form.html possibly missing action #12

Closed ericchou1 closed 5 years ago

ericchou1 commented 5 years ago

Hi, I could be wrong, but it 'seems' to me that the registration_form.html downloaded and unzip from repository was missing the view in the action? Maybe some default function in django_registration.backends.activation.urls?

This was the default registration_form.html:

<h2>Sign up today!</h2>
<form class="pure-form pure-form-stacked" method="post" action=".">
  {% csrf_token %}

I followed the instruction video to set up urls.py under mysite, which directs to django_registration.backends.activation.urls; not sure where that urls.py have associated functions in another views.py file somewhere.

I will rewatch the videos again to make sure I did not miss anything. Thanks!

ericchou1 commented 5 years ago

I understand the part about blank or '.' action goes to the view (https://stackoverflow.com/questions/42195432/django-registration-registration-form). The project urls.py and templates were followed exactly by the steps in the video to the best of my ability:

mysite/urls.py

urlpatterns = [
    path('', include('quotes.urls')),
    path('my-backend/', admin.site.urls),
    path(r'accounts/', include('django_registration.backends.activation.urls')),
    path(r'accounts/', include('django.contrib.auth.urls')),
]

tree structure under mysite/templates/:

(venv) :templates $ tree .
.
├── base.html
├── django_registration
│   ├── activation_complete.html
│   ├── activation_email_body.txt
│   ├── activation_email_subject.txt
│   ├── activation_failed.html
│   ├── registration_closed.html
│   ├── registration_complete.html
│   └── registration_form.html
└── registration
    ├── login.html
    ├── logout.html
    ├── password_change_done.html
    ├── password_change_form.html
    ├── password_reset_complete.html
    ├── password_reset_confirm.html
    ├── password_reset_done.html
    ├── password_reset_email.html
    ├── password_reset_email.txt
    └── password_reset_form.html

2 directories, 18 files

Maybe this is better redirected to Slack?

bbelderbos commented 5 years ago

Yep discussing on Slack and will document solution here ...

ericchou1 commented 5 years ago

Seems to be something I missed since @bbelderbos was able to follow the same steps again without error.

mikeckennedy commented 5 years ago

Thank you guys!