Merge branch 'setup' of https://bitbucket.org/PekopT/archilance into setup
commit
3aaca296dd
5 changed files with 72 additions and 2 deletions
@ -0,0 +1,18 @@ |
||||
from django import forms |
||||
from django.forms import ModelForm |
||||
|
||||
from .models import User |
||||
|
||||
class UserEditForm(ModelForm): |
||||
|
||||
class Meta: |
||||
model = User |
||||
fields = ( |
||||
'first_name', |
||||
'last_name', |
||||
'patronym', |
||||
'location', |
||||
'date_of_birth', |
||||
'website', |
||||
) |
||||
|
||||
@ -0,0 +1,12 @@ |
||||
from django.http import HttpResponseForbidden |
||||
|
||||
|
||||
class CheckForUserMixin(object): |
||||
|
||||
def dispatch(self, request, *args, **kwargs): |
||||
pk = kwargs.get('pk') |
||||
if pk: |
||||
if request.user.pk != int(pk): |
||||
return HttpResponseForbidden('403 Forbidden') |
||||
|
||||
return super().dispatch(request, *args, **kwargs) |
||||
@ -0,0 +1,11 @@ |
||||
{#{% extends 'partials/base.html' %}#} |
||||
{##} |
||||
{#{% load staticfiles %}#} |
||||
{##} |
||||
{#{% block content %}#} |
||||
<form method="post">{% csrf_token %} |
||||
{{ form.errors }} |
||||
{{ form.as_p }} |
||||
<input type="submit" value="Сохранить" /> |
||||
</form> |
||||
{#{% endblock %}#} |
||||
Loading…
Reference in new issue