1. powersurge360
  2. share_search

Commits

powersurge360  committed 3d90eb2

Added in first take on editting stores.

  • Participants
  • Parent commits f5400cb
  • Branches master

Comments (0)

Files changed (2)

File share_search/reviews/urls.py

View file
 from django.views.generic import TemplateView
 
 from reviews.views import (StoreDetailView, StoreListView,
-                           ProductDetailView, StoreCreateView, ProductListView)
+                           StoreUpdateView,
+                           ProductDetailView, StoreCreateView)
 
 
 urlpatterns = patterns(
     '',
     url(r'^stores/$', StoreListView.as_view(), name="store_list"),
     url(r'^stores/(?P<pk>\d+)/$', StoreDetailView.as_view(), name="store"),
+    url(
+        r'^stores/edit/(?P<pk>\d+)/$',
+        StoreUpdateView.as_view(),
+        name="store_edit"
+    ),
     url(r'^stores/create/$', StoreCreateView.as_view(), name="store"),
     url(r'^products/$', TemplateView.as_view(template_name="reviews/products.html"), name="product_list"),
     url(r'^stores/create/$', StoreCreateView.as_view(), name="store_create"),

File share_search/reviews/views.py

View file
 from braces.views import LoginRequiredMixin
-from django.views.generic import DetailView, ListView, CreateView
+from django.views.generic import DetailView, ListView, CreateView, UpdateView
 
 from reviews.forms import StoreForm
 from reviews.models import Store, Product
     form_class = StoreForm
 
 
+class StoreUpdateView(LoginRequiredMixin, UpdateView):
+    model = Store
+    form_class = StoreForm
+
+
 class ProductDetailView(DetailView):
     model = Product