Addition of the stock parameter to the counter admin list

This commit is contained in:
guillaume-renaud
2016-11-08 18:14:41 +01:00
parent 33c7e7db9f
commit 29fb0af893
5 changed files with 43 additions and 5 deletions

View File

@ -1 +1,11 @@
TOTO
{% extends "core/base.jinja" %}
{% block title %}
{{stock}}
{% endblock %}
{% block content %}
<h3>{{stock}}</h3>
<a href="{{ url('stock:new_item', stock_id=stock.id) }}">{{stock.name}}</a>
{% endblock %}

View File

@ -3,6 +3,7 @@ from django.conf.urls import include, url
from stock.views import *
urlpatterns = [
url(r'^(?P<counter_id>[0-9]+)$', StockListView.as_view(), name='stock_list'),
url(r'^(?P<counter_id>[0-9]+)/new$', StockCreateView.as_view(), name='stock_new'),
url(r'^(?P<stock_id>[0-9]+)$', StockMain.as_view(), name='main'),
url(r'^new/counter/(?P<counter_id>[0-9]+)$', StockCreateView.as_view(), name='new'),
url(r'^(?P<stock_id>[0-9]+)/newItem$', StockItemCreateView.as_view(), name='new_item'),
]

View File

@ -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):
"""
"""