Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
from django.contrib.auth.views import logout urlpatterns = [ ... url(r'^accounts/logout/$', logout), ... ]
{% for answer in question.answer_set.all %} ...
instance.comment_article = Article.objects.get(id=self.kwargs['article_id'])
class CommentView(CreateView): def get_initial(self): initial = super(CommentView, self).get_initial(): initial['comment_article'] = Article.objects.get(id=self.kwargs['article_id']) return initial
admin.ModelAdmin
@receiver(pre_save, sender=Numbers) def fill_place(sender, instance, **kwargs): instance.place = instance.hotel.place