-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDjango_users_app_guide.txt
54 lines (37 loc) · 1.19 KB
/
Django_users_app_guide.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#create the app
python manage.py stratapp users
#add the app in the mywebsites project's seettings.py installed list:
#install the crispy -form for user registrations
pip install django-crispy-forms
pip install crispy-bootstrap4
#Add the installed app in settings.py
'crispy_forms',
'crispy_bootstrap4
#Also add the Template pack for bootstrap
CRISPY_TEMPLATE_PACK ='bootstrap4
#then load the templates with
{% load crispy_forms_tags %}
{{ form|crispy }}
#Implemetning logging
#==========================================================================================#
#Accesing the Profile Models
python manage.py shell
>>> from django.contrib.auth.models import User
>>> user = User.objects.filter(username = 'JP').first()
>>> user
<User: JP>
>>> user.profile
<Profile: JP Profile>
>>> user.profile.image
<ImageFieldFile: profile_pics/637966.jpg>
>>> user.profile.image.width
1600
>>> user.profile.image.height
1000
>>> user.profile.image.url
'/profile_pics/637966.jpg'
#For user profile we need to add the media route or static route file in url pattern of project's url.py
#this is diffrent of development and deployement
#reset password
with the requirement
uidb64=uid token=token %}