Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

fixing the url import on urls.py and adding path #972

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions {{cookiecutter.repo_name}}/{{cookiecutter.app_name}}/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from django.conf.urls import url
from django.urls import path
from django.views.generic import TemplateView

from . import views
Expand All @@ -8,30 +8,30 @@
app_name = '{{ cookiecutter.app_name }}'
urlpatterns = [
{% if cookiecutter.models == "Comma-separated list of models" -%}
url(r'', TemplateView.as_view(template_name="base.html")),
path(r'', TemplateView.as_view(template_name="base.html")),
{% else -%}
{% for model in cookiecutter.models.split(',') -%}
url(
path(
regex="^{{ model.strip() }}/~create/$",
view=views.{{ model.strip() }}CreateView.as_view(),
name='{{ model.strip() }}_create',
),
url(
path(
regex="^{{ model.strip() }}/(?P<pk>\d+)/~delete/$",
view=views.{{ model.strip() }}DeleteView.as_view(),
name='{{ model.strip() }}_delete',
),
url(
path(
regex="^{{ model.strip() }}/(?P<pk>\d+)/$",
view=views.{{ model.strip() }}DetailView.as_view(),
name='{{ model.strip() }}_detail',
),
url(
path(
regex="^{{ model.strip() }}/(?P<pk>\d+)/~update/$",
view=views.{{ model.strip() }}UpdateView.as_view(),
name='{{ model.strip() }}_update',
),
url(
path(
regex="^{{ model.strip() }}/$",
view=views.{{ model.strip() }}ListView.as_view(),
name='{{ model.strip() }}_list',
Expand Down