0.0.12
profile routines
This commit is contained in:
@@ -39,6 +39,7 @@ class Admin_ProfileInline(admin.StackedInline):
|
||||
(None, {
|
||||
'classes': ['wide'],
|
||||
'fields': (
|
||||
('account_type',),
|
||||
('enable',),
|
||||
('phone',),
|
||||
('country', 'city'),
|
||||
|
||||
@@ -33,7 +33,7 @@ def registration_ajax(request):
|
||||
|
||||
res_Dict = {}
|
||||
|
||||
JsonResponse(res_Dict)
|
||||
return JsonResponse(res_Dict)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
|
||||
18
AuthApp/migrations/0003_userprofile_avatar.py
Normal file
18
AuthApp/migrations/0003_userprofile_avatar.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.2 on 2023-07-11 12:12
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('AuthApp', '0002_alter_userprofile_city'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='userprofile',
|
||||
name='avatar',
|
||||
field=models.ImageField(blank=True, null=True, upload_to='uploads/', verbose_name='Аватар'),
|
||||
),
|
||||
]
|
||||
18
AuthApp/migrations/0004_alter_userprofile_account_type.py
Normal file
18
AuthApp/migrations/0004_alter_userprofile_account_type.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.2 on 2023-07-11 12:17
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('AuthApp', '0003_userprofile_avatar'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='userprofile',
|
||||
name='account_type',
|
||||
field=models.CharField(choices=[('mover', 'Перевозчик'), ('sender', 'Отправитель')], default='sender', max_length=250, verbose_name='Тип учетной записи'),
|
||||
),
|
||||
]
|
||||
@@ -18,19 +18,21 @@ User.add_to_class("__str__", user_name_str)
|
||||
|
||||
|
||||
account_type_choices = (
|
||||
(_('Перевозчик'), 'mover'),
|
||||
(_('Отправитель'), 'sender')
|
||||
('mover', _('Перевозчик')),
|
||||
('sender', _('Отправитель'))
|
||||
)
|
||||
|
||||
|
||||
class UserProfile(BaseModel):
|
||||
|
||||
account_type = models.CharField(
|
||||
max_length=250, verbose_name=_('Тип учетной записи'), choices=account_type_choices, default='base_account')
|
||||
max_length=250, verbose_name=_('Тип учетной записи'), choices=account_type_choices, default='sender')
|
||||
|
||||
user = models.OneToOneField(User, verbose_name=_('Пользователь'), related_name=u'user_profile',
|
||||
null=True, blank=True, on_delete=models.CASCADE)
|
||||
|
||||
avatar = models.ImageField(upload_to='uploads/', verbose_name=_('Аватар'), null=True, blank=True)
|
||||
|
||||
authMailCode = models.CharField(max_length=32, null=True, blank=True)
|
||||
|
||||
phone = models.CharField(max_length=100, verbose_name=_('Телефон'), null=True, blank=True)
|
||||
|
||||
@@ -8,7 +8,8 @@ from django.contrib.auth import views
|
||||
urlpatterns = [
|
||||
|
||||
path('registration/', registration_View, name='registration_page'),
|
||||
path('profile/', user_profile_View, name='user_profile'),
|
||||
path('', user_profile_View, name='user_profile'),
|
||||
path('login/', login_View, name='login_profile'),
|
||||
|
||||
# ajax ----------------
|
||||
# url(r'^login$', user_login_View_ajax, name='user_login_View_ajax'),
|
||||
|
||||
@@ -11,25 +11,32 @@ from django.contrib.auth.decorators import login_required
|
||||
from BaseModels.mailSender import techSendMail
|
||||
from django.utils.translation import gettext as _
|
||||
from datetime import datetime
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
|
||||
def registration_View(request):
|
||||
|
||||
Dict = {}
|
||||
|
||||
t = loader.get_template('pages/p_registration.html')
|
||||
t = loader.get_template('pages/profile/p_registration.html')
|
||||
return HttpResponse(t.render(Dict, request))
|
||||
|
||||
|
||||
login_required(login_url='/login/')
|
||||
def user_profile_View(request):
|
||||
|
||||
Dict = {}
|
||||
|
||||
t = loader.get_template('pages/p_user_profile.html')
|
||||
t = loader.get_template('pages/profile/p_user_profile.html')
|
||||
return HttpResponse(t.render(Dict, request))
|
||||
|
||||
|
||||
def login_View(request):
|
||||
|
||||
Dict = {}
|
||||
|
||||
t = loader.get_template('pages/profile/p_login.html')
|
||||
return HttpResponse(t.render(Dict, request))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user