File tree Expand file tree Collapse file tree 11 files changed +110
-0
lines changed Expand file tree Collapse file tree 11 files changed +110
-0
lines changed Original file line number Diff line number Diff line change 4444 "constance.backends.database" ,
4545 # apps
4646 "sponsor" ,
47+ "status" ,
4748 # swagger
4849 "drf_spectacular" ,
4950]
Original file line number Diff line number Diff line change 2323)
2424
2525import sponsor .routers
26+ import status .urls
2627
2728urlpatterns = [
2829 path ("api-auth/" , include ("rest_framework.urls" )),
2930 path ("summernote/" , include ("django_summernote.urls" )),
3031 path ("admin/" , admin .site .urls ),
3132 path ("sponsors/" , include (sponsor .routers .get_router ().urls )),
33+ path ("status/" , include (status .urls )),
3234]
3335
3436if settings .DEBUG is True :
Original file line number Diff line number Diff line change 1+ from django .contrib import admin
2+
3+ from status .models import Status
4+
5+
6+ class StatusAdmin (admin .ModelAdmin ):
7+ list_display = ("name" , "open_at" , "close_at" )
8+ list_editable = (
9+ "open_at" ,
10+ "close_at" ,
11+ )
12+ ordering = ("open_at" ,)
13+ search_fields = ("name" ,)
14+
15+
16+ admin .site .register (Status , StatusAdmin )
Original file line number Diff line number Diff line change 1+ from django .apps import AppConfig
2+
3+
4+ class StatusConfig (AppConfig ):
5+ default_auto_field = "django.db.models.BigAutoField"
6+ name = "status"
Original file line number Diff line number Diff line change 1+ # Generated by Django 4.1.5 on 2023-02-24 17:43
2+
3+ from django .db import migrations , models
4+
5+
6+ class Migration (migrations .Migration ):
7+
8+ initial = True
9+
10+ dependencies = []
11+
12+ operations = [
13+ migrations .CreateModel (
14+ name = "Status" ,
15+ fields = [
16+ (
17+ "id" ,
18+ models .BigAutoField (
19+ auto_created = True ,
20+ primary_key = True ,
21+ serialize = False ,
22+ verbose_name = "ID" ,
23+ ),
24+ ),
25+ ("name" , models .CharField (max_length = 100 )),
26+ ("open_at" , models .DateTimeField ()),
27+ ("close_at" , models .DateTimeField ()),
28+ ],
29+ ),
30+ ]
Original file line number Diff line number Diff line change 1+ from django .db import models
2+
3+
4+ class Status (models .Model ):
5+ name = models .CharField (max_length = 100 )
6+ open_at = models .DateTimeField ()
7+ close_at = models .DateTimeField ()
Original file line number Diff line number Diff line change 1+ from django .test import TestCase
2+
3+ # Create your tests here.
Original file line number Diff line number Diff line change 1+ """pyconkr URL Configuration
2+
3+ The `urlpatterns` list routes URLs to views. For more information please see:
4+ https://docs.djangoproject.com/en/4.1/topics/http/urls/
5+ Examples:
6+ Function views
7+ 1. Add an import: from my_app import views
8+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
9+ Class-based views
10+ 1. Add an import: from other_app.views import Home
11+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12+ Including another URLconf
13+ 1. Import the include() function: from django.urls import include, path
14+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15+ """
16+ from django .contrib import admin
17+ from django .urls import include , path
18+
19+ from status .views import StatusView
20+
21+ urlpatterns = [
22+ path ("<str:name>" , StatusView .as_view ()),
23+ ]
You can’t perform that action at this time.
0 commit comments