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))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ urlpatterns += i18n_patterns(
|
||||
path('admin/', admin.site.urls),
|
||||
|
||||
path('', include('GeneralApp.urls')),
|
||||
path('', include('AuthApp.urls')),
|
||||
path('profile/', include('AuthApp.urls')),
|
||||
|
||||
path('user_account/', include('AuthApp.js_urls')),
|
||||
)
|
||||
|
||||
@@ -56,7 +56,7 @@ class Admin_BaseModelViewPage(Admin_BaseIconModel):
|
||||
'seo_text'
|
||||
)
|
||||
})
|
||||
fieldsets[0][1]['fields'].append('url')
|
||||
# fieldsets[0][1]['fields'].append('url')
|
||||
fieldsets.append(seo_block)
|
||||
return fieldsets
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<div><svg xmlns="http://www.w3.org/2000/svg" width="28" height="30" viewBox="0 0 28 30" fill="none">
|
||||
<path d="M27 13.9233H22.7003C22.1301 13.9233 21.5833 14.1502 21.1801 14.5542C20.7769 14.9581 20.5504 15.5059 20.5504 16.0771V21.4616C20.5504 22.0329 20.7769 22.5807 21.1801 22.9846C21.5833 23.3885 22.1301 23.6155 22.7003 23.6155H24.8501C25.4203 23.6155 25.9671 23.3885 26.3703 22.9846C26.7735 22.5807 27 22.0329 27 21.4616M27 13.9233V21.4616M27 13.9233C27.0001 12.2172 26.6629 10.5279 26.0079 8.95295C25.353 7.37801 24.3932 5.9486 23.184 4.74718C21.9748 3.54576 20.5401 2.59613 18.9626 1.95306C17.3852 1.31 15.6963 0.986231 13.9933 1.00045C12.2914 0.988016 10.604 1.3131 9.02807 1.95697C7.45219 2.60083 6.01907 3.55075 4.81129 4.75199C3.6035 5.95323 2.64494 7.38204 1.99081 8.95608C1.33669 10.5301 0.999955 12.2183 1 13.9233M27 21.4616V24.6924C27 25.8348 26.547 26.9305 25.7406 27.7383C24.9343 28.5462 23.8406 29 22.7003 29H14.9742M1 13.9233V21.4616C1 22.0329 1.2265 22.5807 1.62968 22.9846C2.03286 23.3885 2.57969 23.6155 3.14987 23.6155H5.29974C5.86992 23.6155 6.41675 23.3885 6.81993 22.9846C7.22311 22.5807 7.44961 22.0329 7.44961 21.4616V16.0771C7.44961 15.5059 7.22311 14.9581 6.81993 14.5542C6.41675 14.1502 5.86992 13.9233 5.29974 13.9233H1Z" stroke="#272424" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
||||
</svg><a href="#">Служба поддержки</a></div>
|
||||
<a href="#">Регистрация</a>
|
||||
<a href="#">Войти</a>
|
||||
<a href="{% url "registration_page" %}">Регистрация</a>
|
||||
<a href="{% url "login_profile" %}">Войти</a>
|
||||
</div>
|
||||
</header>
|
||||
@@ -32,14 +32,15 @@
|
||||
</svg><a href="#">Мой профиль</a></div>
|
||||
</div>
|
||||
<div class="info_profile">
|
||||
<h1>Добро пожаловать: <span>Иван</span> <span>(ivanship)</span></h1>
|
||||
<div class="profile_prof"><img class="avatar_profile" src="./style/img/avatar.png" alt="">
|
||||
<h1>Добро пожаловать: <span>{{ user.first_name }} {{ user.last_name }}</span> <span>({{ user.username }})</span></h1>
|
||||
<div class="profile_prof"><img class="avatar_profile" src="{{ user.user_profile.avatar }}" alt="">
|
||||
<div>
|
||||
<div>Статус:</div>
|
||||
<div><select name="" id="">
|
||||
<option>Перевозчик</option>
|
||||
<option>Отправитель</option>
|
||||
</select></div>
|
||||
<div>Статус: {{ user.user_profile.get_account_type_display }}</div>
|
||||
{# <div>#}
|
||||
{# <select name="" id="">#}
|
||||
{# <option>Перевозчик</option>#}
|
||||
{# <option>Отправитель</option>#}
|
||||
{# </select></div>#}
|
||||
</div>
|
||||
</div>
|
||||
<div>Если хотите отправить посылку - зарегистрируйтесь, как отправитель</div>
|
||||
|
||||
16
templates/pages/profile/p_login.html
Normal file
16
templates/pages/profile/p_login.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
{% include 'inter/meta.html' %}
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
{% include 'blocks/b_header.html' %}
|
||||
{% include 'blocks/b_login.html' %}
|
||||
{% include 'blocks/b_footer.html' %}
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user