# -*- coding: utf-8 -*-g
- g надо убрать.verbose_name='Город'
verbose_name=u'Город'
(r'^accounts/', include('registration.backends.default.urls')),
from django.db.models.query import QuerySet
class LoginRequiredMixin(View):
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(LoginRequiredMixin, self).dispatch(*args, **kwargs)
class ProfileUpdateView(LoginRequiredMixin, UpdateView):
...
from django.shortcuts import get_object_or_404
...
url_name = request.resolver_match.url_name
if url_name == 'add1':
pk = 1
elif url_name == 'add2':
pk = 2
obj = get_object_or_404(PleaseModelNormalName, pk=pk)
f = ModelForm(request.POST, initial={'models_views': obj})