Skip to content

Commit 3c04de3

Browse files
committed
add another path django example
1 parent 5182958 commit 3c04de3

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
title: django.contrib.admin Examples
2+
category: page
3+
slug: django-contrib-admin-examples
4+
sortorder: 50001
5+
toc: False
6+
sidebartitle: django.contrib.admin
7+
meta: Python code examples for the admin module within django.contrib of the Django project.
8+
9+
10+
# django.contrib.admin Examples
11+
12+
13+
## Example 1 from heritagesites

content/pages/examples/django/django-urls-path.markdown

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,37 @@ if settings.USE_DEBUG_TOOLBAR:
5454

5555
] + urlpatterns
5656
```
57+
58+
59+
## Example 2 from heritagesites
60+
[heritagesites](https://github.com/Michael-Cantley/heritagesites) is a
61+
[Django](/django.html) web application with a [MySQL](/mysql.html)
62+
backend that displays
63+
[UNESCO heritage sites](https://whc.unesco.org/en/list/). The project
64+
code is open source under the
65+
[MIT license](https://github.com/Michael-Cantley/heritagesites/blob/master/LICENSE).
66+
67+
[**heritagesites/heritagesites/urls.py**](https://github.com/Michael-Cantley/heritagesites/blob/master/heritagesites/urls.py)
68+
69+
```python
70+
# urls.py
71+
~~from django.urls import path, re_path
72+
from . import views
73+
74+
75+
urlpatterns = [
76+
~~ path('', views.HomePageView.as_view(), name='home'),
77+
~~ path('about/', views.AboutPageView.as_view(), name='about'),
78+
~~ path('countries/', views.CountryAreaListView.as_view(), name='country_area'),
79+
~~ path('countries/<int:pk>/', views.CountryAreaDetailView.as_view(),
80+
name='country_area_detail'),
81+
~~ path('sites/', views.SiteListView.as_view(), name='sites'),
82+
~~ path('sites/<int:pk>/', views.SiteDetailView.as_view(), name='site_detail'),
83+
84+
~~ path('sites/new/', views.SiteCreateView.as_view(), name='site_new'),
85+
~~ path('sites/<int:pk>/delete/', views.SiteDeleteView.as_view(), name='site_delete'),
86+
~~ path('sites/<int:pk>/update/', views.SiteUpdateView.as_view(), name='site_update'),
87+
88+
~~ path('sites/search', views.SiteFilterView.as_view(), name="search")
89+
]
90+
```

theme/templates/table-of-contents.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ <h4 class="bp"><a href="/django-db-models-signal-examples.html">django.db.models
220220
<h4 class="bp"><a href="/django-db-models-model-examples.html">django.db.models.Model</a></h4>
221221
<h4 class="bp"><a href="/django-dispatch-dispatcher-signal-examples.html">django.dispatch.dispatcher.Signal</a></h4>
222222
<h4 class="bp"><a href="/django-forms-examples.html">django.forms</a></h4>
223+
<h4 class="bp">django.utils</h4>
223224
<h4 class="bp"><a href="/django-utils-timezone-examples.html">django.utils.timezone</a></h4>
224225

225226
<br>

0 commit comments

Comments
 (0)