File tree Expand file tree Collapse file tree 5 files changed +92
-3
lines changed Expand file tree Collapse file tree 5 files changed +92
-3
lines changed Original file line number Diff line number Diff line change 11div {
2- margin-top : 40px ;
2+ margin-top : 40px ;
33}
44
55label {
6- font-weight : bold;
6+ font-weight : bold;
77}
Original file line number Diff line number Diff line change 1+ from django_unicorn .components import UnicornView
2+
3+
4+ class JsView (UnicornView ):
5+ states = (
6+ "Alabama" ,
7+ "Alaska" ,
8+ "Arizona" ,
9+ "Arkansas" ,
10+ "California" ,
11+ "Colorado" ,
12+ "Connecticut" ,
13+ "Delaware" ,
14+ "Florida" ,
15+ "Georgia" ,
16+ "Hawaii" ,
17+ "Idaho" ,
18+ "Illinois" ,
19+ "Indiana" ,
20+ "Iowa" ,
21+ "Kansas" ,
22+ "Kentucky" ,
23+ "Louisiana" ,
24+ "Maine" ,
25+ "Maryland" ,
26+ "Massachusetts" ,
27+ "Michigan" ,
28+ "Minnesota" ,
29+ "Mississippi" ,
30+ "Missouri" ,
31+ "Montana" ,
32+ "Nebraska" ,
33+ "Nevada" ,
34+ "New Hampshire" ,
35+ "New Jersey" ,
36+ "New Mexico" ,
37+ "New York" ,
38+ "North Carolina" ,
39+ "North Dakota" ,
40+ "Ohio" ,
41+ "Oklahoma" ,
42+ "Oregon" ,
43+ "Pennsylvania" ,
44+ "Rhode Island" ,
45+ "South Carolina" ,
46+ "South Dakota" ,
47+ "Tennessee" ,
48+ "Texas" ,
49+ "Utah" ,
50+ "Vermont" ,
51+ "Virginia" ,
52+ "Washington" ,
53+ "West Virginia" ,
54+ "Wisconsin" ,
55+ "Wyoming" ,
56+ )
57+
58+ class Meta :
59+ javascript_excludes = ("states" ,)
Original file line number Diff line number Diff line change 1+ < div >
2+ {% for state in states %}
3+ {{ state }}
4+ {% endfor %}
5+ </ div >
Original file line number Diff line number Diff line change 55 < title > django-unicorn examples</ title >
66 < link rel ="stylesheet " href ="{% static 'css/marx.min.css' %} ">
77 < link rel ="stylesheet " href ="{% static 'css/styles.css' %} ">
8+ < style >
9+ # menu {
10+ list-style : none;
11+ }
12+ # menu li {
13+ display : inline;
14+ padding : 0 10px ;
15+ border-left : solid 1px black;
16+ }
17+ # menu li : first-child {
18+ border-left : none !important ;
19+ }
20+ </ style >
21+
822 {% unicorn_scripts %}
923 </ head >
1024
1428
1529 < h1 > django-unicorn</ h1 >
1630
17- < ul >
31+ < ul id =" menu " >
1832 < li > < a href ="{% url 'www:index' %} "> Index</ a > </ li >
1933 < li > < a href ="{% url 'www:template' 'text-inputs' %} "> Text inputs</ a > </ li >
2034 < li > < a href ="{% url 'www:template' 'html-inputs' %} "> Other inputs</ a > </ li >
@@ -23,6 +37,7 @@ <h1>django-unicorn</h1>
2337 < li > < a href ="{% url 'www:template' 'polling' %} "> Polling</ a > </ li >
2438 < li > < a href ="{% url 'www:template' 'models' %} "> Models</ a > </ li >
2539 < li > < a href ="{% url 'www:template' 'nested' %} "> Nested components (table)</ a > </ li >
40+ < li > < a href ="{% url 'www:template' 'js' %} "> JavaScript integration</ a > </ li >
2641 </ ul >
2742
2843 {% block content %}{% endblock content %}
Original file line number Diff line number Diff line change 1+ {% extends "www/base.html" %}
2+ {% load static unicorn %}
3+
4+ {% block content %}
5+
6+ < h2 > JavaScript integration</ h2 >
7+
8+ {% unicorn 'js' %}
9+
10+ {% endblock content %}
You can’t perform that action at this time.
0 commit comments