I used this social registration/signup library django allauth for a project of mine. How do i customize the default templates and forms to give a better look and feel?
相关问题
- Django __str__ returned non-string (type NoneType)
- Django & Amazon SES SMTP. Cannot send email
- Django check user group permissions
- Django restrict pages to certain users
- UnicodeEncodeError with attach_file on EmailMessag
相关文章
- Profiling Django with PyCharm
- Why doesn't Django enforce my unique_together
- MultiValueDictKeyError in Django admin
- Django/Heroku: FATAL: too many connections for rol
- Django is sooo slow? errno 32 broken pipe? dcramer
- Django: Replacement for the default ManyToMany Wid
- Upgrading transaction.commit_manually() to Django
- UnicodeEncodeError when saving ImageField containi
Use the same logic as overriding admin templates.
Assuming you have set a project level templates directory using the
TEMPLATE_DIRS
setting like:You should be able to copy all of the folders shown here into that directory and edit them as you need. Most of the templates seem to be filling a
{% block content %}
block, so it's probably easiest if yoursite_base.html
template defines that block somewhere.If you haven't set
TEMPLATE_DIRS
, you can do the same thing, but copy the template folders into thetemplates
directory of one of your apps. I prefer to setTEMPLATE_DIRS
and keep the main site templates likebase.html
there, since they don't really belong to a particular app, but that's really just a preference; the template loader should find them either way.In your views:
Do pay attention to the examples and docs for structuring your own templates.
Watch this piece in the example templates though:
I had to remove the URL link to make it work properly in my own template:
To customize django-allauth after installing it, copy it from site-packages and paste it in your project apps directory. In this way the default allauth app and its templates being used will be those in your project's allauth app. Then if you want to modify signup.html of socialaccount then go to apps\allauth\templates\socialaccount\signup.html and modify it by editting inside 'block content' tag:
Hope this will help you.
Have a look at the
example
application; it has atemplates
folder that indicates the layout of the necessary templatesthe latest version of all-auth on github has its templates outside, however the one on Pypi is not, all you need to do is clone the repo in your project directory and override the templates. As simple as that.