diff --git a/counter/templates/counter/counter_list.jinja b/counter/templates/counter/counter_list.jinja index 195d1175..68c33cbf 100644 --- a/counter/templates/counter/counter_list.jinja +++ b/counter/templates/counter/counter_list.jinja @@ -33,7 +33,12 @@ {% trans %}Stats{% endtrans %} - {% endif %} {% if user.is_owner(c) %} - {% trans %}Props{% endtrans %} + {% trans %}Props{% endtrans %} - + {%if c.stock %} + {{c.stock}} + {% else %} + {% trans %}Create new stock{% endtrans%} + {% endif %} {% endif %} {% endfor %} diff --git a/sith/urls.py b/sith/urls.py index d759979e..075e2f20 100644 --- a/sith/urls.py +++ b/sith/urls.py @@ -34,6 +34,7 @@ urlpatterns = [ url(r'^com/', include('com.urls', namespace="com", app_name="com")), url(r'^club/', include('club.urls', namespace="club", app_name="club")), url(r'^counter/', include('counter.urls', namespace="counter", app_name="counter")), + url(r'^stock/', include('stock.urls', namespace="stock", app_name="stock")), url(r'^accounting/', include('accounting.urls', namespace="accounting", app_name="accounting")), url(r'^eboutic/', include('eboutic.urls', namespace="eboutic", app_name="eboutic")), url(r'^launderette/', include('launderette.urls', namespace="launderette", app_name="launderette")), diff --git a/stock/templates/stock/stock_main.jinja b/stock/templates/stock/stock_main.jinja index fe9f8145..3cf56022 100644 --- a/stock/templates/stock/stock_main.jinja +++ b/stock/templates/stock/stock_main.jinja @@ -1 +1,11 @@ -TOTO \ No newline at end of file +{% extends "core/base.jinja" %} + +{% block title %} +{{stock}} +{% endblock %} + +{% block content %} +

{{stock}}

+{{stock.name}} +{% endblock %} + diff --git a/stock/urls.py b/stock/urls.py index 1b3a504e..0f5ae091 100644 --- a/stock/urls.py +++ b/stock/urls.py @@ -3,6 +3,7 @@ from django.conf.urls import include, url from stock.views import * urlpatterns = [ - url(r'^(?P[0-9]+)$', StockListView.as_view(), name='stock_list'), - url(r'^(?P[0-9]+)/new$', StockCreateView.as_view(), name='stock_new'), + url(r'^(?P[0-9]+)$', StockMain.as_view(), name='main'), + url(r'^new/counter/(?P[0-9]+)$', StockCreateView.as_view(), name='new'), + url(r'^(?P[0-9]+)/newItem$', StockItemCreateView.as_view(), name='new_item'), ] diff --git a/stock/views.py b/stock/views.py index 91ea44a2..c60c3528 100644 --- a/stock/views.py +++ b/stock/views.py @@ -1,3 +1,24 @@ from django.shortcuts import render +from django.views.generic import ListView, DetailView, RedirectView, TemplateView +from django.views.generic.edit import UpdateView, CreateView, DeleteView, ProcessFormView, FormMixin -# Create your views here. + +from stock.models import Stock + +class StockMain(DetailView): + """ + The stock view for the counter owner + """ + model = Stock + template_name = 'stock/stock_main.jinja' + pk_url_kwarg = "stock_id" + +class StockCreateView(CreateView): + """ + docstring for StockCreateView + """ + +class StockItemCreateView(CreateView): + """ + + """ \ No newline at end of file