Browse Source

Add members list.

feature/python-error-tracking
Drew Larson 9 years ago
parent
commit
db1f78d3ef
  1. 1
      bikeshop_project/core/static/scss/screen.scss
  2. 22
      bikeshop_project/registration/templates/members.html
  3. 5
      bikeshop_project/registration/urls.py
  4. 8
      bikeshop_project/registration/views.py

1
bikeshop_project/core/static/scss/screen.scss

@ -13,6 +13,7 @@
@import "vendor/material-design-lite/src/menu/menu"; @import "vendor/material-design-lite/src/menu/menu";
@import "vendor/material-design-lite/src/card/card"; @import "vendor/material-design-lite/src/card/card";
@import "vendor/material-design-lite/src/data-table/data-table"; @import "vendor/material-design-lite/src/data-table/data-table";
@import "vendor/material-design-lite/src/list/list";
html, body { html, body {
font-family: 'Roboto', 'Helvetica', sans-serif; font-family: 'Roboto', 'Helvetica', sans-serif;

22
bikeshop_project/registration/templates/members.html

@ -0,0 +1,22 @@
{% extends 'dashboard.html' %}
{% block content %}
<div class="mdl-cell mdl-cell--6-col">
<ul class="demo-list-three mdl-list">
{% for member in members %}
<li class="mdl-list__item mdl-list__item--three-line">
<span class="mdl-list__item-primary-content">
<i class="material-icons mdl-list__item-avatar">person</i>
<span>{{ member.full_name }}</span>
<span class="mdl-list__item-text-body">
{{ member.email }}
</span>
</span>
<span class="mdl-list__item-secondary-content">
<a class="mdl-list__item-secondary-action" href="{% url 'member_edit' member_id=member.id %}"><i class="material-icons">edit</i></a>
</span>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}

5
bikeshop_project/registration/urls.py

@ -1,9 +1,10 @@
from django.conf.urls import url from django.conf.urls import url
from .views import MemberFormView, MemberSearchView, MemberSignIn from .views import MemberFormView, MemberSearchView, MemberSignIn, Members
urlpatterns = [ urlpatterns = [
url(r'^new/$', MemberFormView.as_view(), name='member_new'), url(r'^new/$', MemberFormView.as_view(), name='member_new'),
url(r'^search/(?P<query>[\w@\.\+]+)/$', MemberSearchView.as_view(), name='member_search'), url(r'^search/(?P<query>[\w@\.\+]+)/$', MemberSearchView.as_view(), name='member_search'),
url(r'^edit/(?P<member_id>[0-9]+)/$', MemberFormView.as_view(), name='member_edit'), url(r'^edit/(?P<member_id>[0-9]+)/$', MemberFormView.as_view(), name='member_edit'),
url(r'^signin/$', MemberSignIn.as_view(), name='member_signin') url(r'^signin/$', MemberSignIn.as_view(), name='member_signin'),
url(r'^$', Members.as_view(), name='members'),
] ]

8
bikeshop_project/registration/views.py

@ -9,6 +9,7 @@ from django.utils import timezone
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View from django.views.generic import View
from django.views.generic import TemplateView
from core.models import Visit from core.models import Visit
from haystack.query import SearchQuerySet from haystack.query import SearchQuerySet
@ -103,3 +104,10 @@ class MemberSignIn(View):
json = JSONRenderer().render(serializer.data) json = JSONRenderer().render(serializer.data)
return JsonResponse(data=json.decode(), safe=False, status=200) return JsonResponse(data=json.decode(), safe=False, status=200)
class Members(TemplateView):
template_name = 'members.html'
def get(self, request):
members = Member.objects.all()
return self.render_to_response(dict(members=members))
Loading…
Cancel
Save