0.0.11
profile page
This commit is contained in:
@@ -26,16 +26,23 @@ def registration_ajax(request):
|
||||
html = render_to_string('forms/f_registration.html', Dict)
|
||||
return JsonResponse({'html': html}, status=400)
|
||||
|
||||
user = User.objects.create_user(username=form.data['email'], email=form.data['email'], password=form.data['password'])
|
||||
# user = auth.authenticate(username=new_user_Dict['name'], password=new_user_Dict['pass'])
|
||||
if user:
|
||||
auth.login(request, user)
|
||||
|
||||
res_data = {
|
||||
'errors': 'тестовый верный ответ'
|
||||
}
|
||||
res_Dict = {}
|
||||
|
||||
JsonResponse(res_Dict)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
res_data = {
|
||||
'errors': f'ошибка в запросе = {str(e)}'
|
||||
errors_Dict = {
|
||||
'errors': {
|
||||
'__all__': f'ошибка в запросе = {str(e)}'
|
||||
}
|
||||
}
|
||||
Dict = {'form': errors_Dict}
|
||||
html = render_to_string('forms/f_registration.html', Dict)
|
||||
return JsonResponse({'html': html}, status=400)
|
||||
|
||||
|
||||
return JsonResponse(res_data)
|
||||
@@ -8,6 +8,7 @@ from django.contrib.auth import views
|
||||
urlpatterns = [
|
||||
|
||||
path('registration/', registration_View, name='registration_page'),
|
||||
path('profile/', user_profile_View, name='user_profile'),
|
||||
|
||||
# ajax ----------------
|
||||
# url(r'^login$', user_login_View_ajax, name='user_login_View_ajax'),
|
||||
|
||||
@@ -21,6 +21,19 @@ def registration_View(request):
|
||||
return HttpResponse(t.render(Dict, request))
|
||||
|
||||
|
||||
def user_profile_View(request):
|
||||
|
||||
Dict = {}
|
||||
|
||||
t = loader.get_template('pages/p_user_profile.html')
|
||||
return HttpResponse(t.render(Dict, request))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def create_personal_user(data, creator):
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user