Skip to content

Commit

Permalink
Indicate market should be a number in urlpatterns
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoMoreta committed Mar 19, 2024
1 parent 6eb67d2 commit 857d18e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 32 deletions.
5 changes: 1 addition & 4 deletions appmes/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,11 @@
path('', include('authentication.urls')),
path('', include('benefits.urls')),
path('', include('offers.urls')),
path('<market>/news/', include('news.urls')),
path('<int:market>/news/', include('news.urls')),

path('admin/', admin.site.urls),
]




if settings.DEBUG:
from django.conf.urls.static import static
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Expand Down
8 changes: 4 additions & 4 deletions authentication/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
path('users/<pk>/', views.UpdateUser.as_view(), name='user_detail'),
path('users/<pk>/delete', views.UserList.as_view(), name='user_delete'),

path('<market>/users/', views.MarketUserList.as_view(), name='user_list'),
path('<market>/users/add/', views.MarketCreateUser.as_view(), name='add_user'),
path('<market>/users/<pk>/', views.MarketUpdateUser.as_view(), name='user_detail'),
path('<market>/users/<pk>/delete', views.UserList.as_view(), name='user_delete'),
path('<int:market>/users/', views.MarketUserList.as_view(), name='user_list'),
path('<int:market>/users/add/', views.MarketCreateUser.as_view(), name='add_user'),
path('<int:market>/users/<pk>/', views.MarketUpdateUser.as_view(), name='user_detail'),
path('<int:market>/users/<pk>/delete', views.UserList.as_view(), name='user_delete'),

path('register/<token>/', views.PreRegister.as_view(), name='preregister'),
path('register/<token>/resend_email/', views.ResendPreregisterEmailAction.as_view(), name='preregister_send_email'),
Expand Down
12 changes: 6 additions & 6 deletions benefits/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
app_name = 'benefits'
urlpatterns = [

path('<market>/benefits/', views.BenefitList.as_view(), name='list'),
path('<market>/benefits/add/', views.BenefitCreate.as_view(), name='add'),
path('<market>/benefits/<pk>/', views.BenefitDetail.as_view(), name='detail'),
path('<market>/benefits/<pk>/edit/', views.BenefitUpdate.as_view(), name='edit'),
path('<market>/benefits/<pk>/delete/', views.BenefitDelete.as_view(), name='delete'),
path('<market>/providers/<pk>/add_benefit/', views.BenefitCreate.as_view(), name='add_provider_benefit'),
path('<int:market>/benefits/', views.BenefitList.as_view(), name='list'),
path('<int:market>/benefits/add/', views.BenefitCreate.as_view(), name='add'),
path('<int:market>/benefits/<pk>/', views.BenefitDetail.as_view(), name='detail'),
path('<int:market>/benefits/<pk>/edit/', views.BenefitUpdate.as_view(), name='edit'),
path('<int:market>/benefits/<pk>/delete/', views.BenefitDelete.as_view(), name='delete'),
path('<int:market>/providers/<pk>/add_benefit/', views.BenefitCreate.as_view(), name='add_provider_benefit'),

path('benefit/', views.BenefitDetail.as_view(), name='user_benefit'),

Expand Down
24 changes: 12 additions & 12 deletions market/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
path('m/<pk>/', views.EditMarket.as_view(), name='edit_market'),

#### Market management #####
path('<market>/dashboard/', views.MarketDashboard.as_view(), name='market_dashboard'),
path('<int:market>/dashboard/', views.MarketDashboard.as_view(), name='market_dashboard'),

# Category
path('<market>/categories/', views.CategoryList.as_view(), name='category_list'),
path('<market>/categories/add/', views.CategoryCreate.as_view(), name='add_category'),
path('<market>/categories/<pk>/', views.CategoryDetail.as_view(), name='category_detail'),
path('<int:market>/categories/', views.CategoryList.as_view(), name='category_list'),
path('<int:market>/categories/add/', views.CategoryCreate.as_view(), name='add_category'),
path('<int:market>/categories/<pk>/', views.CategoryDetail.as_view(), name='category_detail'),

# Providers
path('<market>/providers/', views.ProviderList.as_view(), name='provider_list'),
path('<market>/providers/add/', views.CreateProvider.as_view(), name='add_provider'),
path('<market>/providers/<pk>/', views.DetailProvider.as_view(), name='provider_detail'),
path('<market>/providers/<pk>/edit/', views.UpdateProvider.as_view(), name='edit_provider'),
path('<int:market>/providers/', views.ProviderList.as_view(), name='provider_list'),
path('<int:market>/providers/add/', views.CreateProvider.as_view(), name='add_provider'),
path('<int:market>/providers/<pk>/', views.DetailProvider.as_view(), name='provider_detail'),
path('<int:market>/providers/<pk>/edit/', views.UpdateProvider.as_view(), name='edit_provider'),

# Consumers
path('<market>/consumers/', views.ConsumerList.as_view(), name='consumer_list'),
path('<market>/consumers/add/', views.CreateConsumer.as_view(), name='add_consumer'),
path('<market>/consumers/<pk>/', views.ConsumerDetail.as_view(), name='detail_consumer'),
path('<market>/consumers/<pk>/edit/', views.ConsumerEdit.as_view(), name='edit_consumer'),
path('<int:market>/consumers/', views.ConsumerList.as_view(), name='consumer_list'),
path('<int:market>/consumers/add/', views.CreateConsumer.as_view(), name='add_consumer'),
path('<int:market>/consumers/<pk>/', views.ConsumerDetail.as_view(), name='detail_consumer'),
path('<int:market>/consumers/<pk>/edit/', views.ConsumerEdit.as_view(), name='edit_consumer'),

# Single registration account views
path('dashboard/', views.UserDashboard.as_view(), name='user_dashboard'),
Expand Down
10 changes: 5 additions & 5 deletions offers/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
app_name = 'offers'
urlpatterns = [
path('offers/', views.UserOffers.as_view(), name='user_list'),
path('<market>/offers/', views.OffersList.as_view(), name='list'),
path('<market>/providers/<pk>/offers/', views.ProviderOffers.as_view(), name='entity_offers'),
path('<market>/providers/<pk>/add_offer/', views.CreateOffer.as_view(), name='add'),
path('<market>/offers/<pk>/', views.OfferDetail.as_view(), name='detail'),
path('<market>/offers/<pk>/edit/', views.OfferEdit.as_view(), name='edit'),
path('<int:market>/offers/', views.OffersList.as_view(), name='list'),
path('<int:market>/providers/<pk>/offers/', views.ProviderOffers.as_view(), name='entity_offers'),
path('<int:market>/providers/<pk>/add_offer/', views.CreateOffer.as_view(), name='add'),
path('<int:market>/offers/<pk>/', views.OfferDetail.as_view(), name='detail'),
path('<int:market>/offers/<pk>/edit/', views.OfferEdit.as_view(), name='edit'),
]
2 changes: 1 addition & 1 deletion offers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def form_valid(self, form):
return HttpResponseRedirect(self.get_success_url())

def get_success_url(self):
messages.add_message(self.request, messages.ERROR, 'Oferta añadida con éxito')
messages.add_message(self.request, messages.SUCCESS, 'Oferta añadida con éxito')
return self.reverse('offers:entity_offers', kwargs={'pk': self.kwargs['pk'] })


Expand Down

0 comments on commit 857d18e

Please sign in to comment.