File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
from django .views .generic import TemplateView
2
2
3
+ from .models import District
4
+
3
5
4
6
class IndexView (TemplateView ):
5
7
template_name = "districts/index.html"
6
8
9
+ def get_context_data (self , ** kwargs ):
10
+ context = super ().get_context_data (** kwargs )
11
+ context ["district_queryset" ] = District .objects .all ()
12
+ return context
13
+
7
14
8
15
class DistrictView (TemplateView ):
9
16
template_name = "districts/district.html"
10
17
11
18
def get_context_data (self , ** kwargs ):
12
19
context = super ().get_context_data (** kwargs )
13
20
district = self .kwargs .get ("district" )
14
- context ["district" ] = district
21
+ context ["url_district" ] = district
22
+ context ["district_queryset" ] = District .objects .all ()
23
+ context ["district_query" ] = District .objects .all ().get (number = district )
15
24
return context
You can’t perform that action at this time.
0 commit comments