commit
007dfcd49f
17 changed files with 170 additions and 114 deletions
@ -0,0 +1,19 @@ |
|||||||
|
from django.contrib.sites.models import Site |
||||||
|
from django.views.generic.base import ContextMixin |
||||||
|
|
||||||
|
|
||||||
|
class BaseMixin(ContextMixin): |
||||||
|
def get_context_data(self, **kwargs): |
||||||
|
context = super().get_context_data(**kwargs) |
||||||
|
|
||||||
|
pk = self.kwargs.get('pk') |
||||||
|
|
||||||
|
if pk: |
||||||
|
context['pk'] = pk |
||||||
|
|
||||||
|
context['domain'] = Site.objects.get_current().domain |
||||||
|
|
||||||
|
return context |
||||||
|
|
||||||
|
|
||||||
|
# import code; code.interact(local=dict(globals(), **locals())) |
||||||
@ -1,9 +1,9 @@ |
|||||||
{{ user }} |
{{ request.user }} |
||||||
|
|
||||||
|
|
||||||
<h2>Мои проекты</h2> |
<h2>Мои проекты</h2> |
||||||
|
|
||||||
{% for proj in user.projects.all %} |
{% for proj in request.user.projects.all %} |
||||||
<h3>{{ proj }}</h3> |
<h3>{{ proj }}</h3> |
||||||
<h5>{{ proj.order }}</h5> |
<h5>{{ proj.order }}</h5> |
||||||
{% endfor %} |
{% endfor %} |
||||||
|
|||||||
@ -1,11 +1,6 @@ |
|||||||
{% extends '_layout.html' %} |
{% extends 'partials/base.html' %} |
||||||
|
|
||||||
{% load staticfiles %} |
|
||||||
|
|
||||||
{% block content %} |
{% block content %} |
||||||
<div ng-controller='TestCtrl as test'> |
<h1>project: {{ project }}</h1> |
||||||
<ul ng-repeat='user in test.users'> |
<h1>object: {{ object }}</h1> |
||||||
<li>{( user.first_name )}</li> |
|
||||||
</ul> |
|
||||||
</div> |
|
||||||
{% endblock %} |
{% endblock %} |
||||||
|
|||||||
Loading…
Reference in new issue