punkweb-bb 0.1.4__py3-none-any.whl → 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. punkweb_bb/__pycache__/forms.cpython-311.pyc +0 -0
  2. punkweb_bb/__pycache__/models.cpython-311.pyc +0 -0
  3. punkweb_bb/__pycache__/settings.cpython-311.pyc +0 -0
  4. punkweb_bb/__pycache__/tests.cpython-311.pyc +0 -0
  5. punkweb_bb/__pycache__/urls.cpython-311.pyc +0 -0
  6. punkweb_bb/__pycache__/utils.cpython-311.pyc +0 -0
  7. punkweb_bb/__pycache__/views.cpython-311.pyc +0 -0
  8. punkweb_bb/forms.py +40 -7
  9. punkweb_bb/migrations/0003_alter_thread_options.py +23 -0
  10. punkweb_bb/migrations/__pycache__/0003_alter_thread_options.cpython-311.pyc +0 -0
  11. punkweb_bb/models.py +25 -0
  12. punkweb_bb/settings.py +1 -0
  13. punkweb_bb/static/punkweb_bb/css/category-form.css +24 -0
  14. punkweb_bb/static/punkweb_bb/css/index.css +6 -0
  15. punkweb_bb/static/punkweb_bb/css/punkweb.css +155 -8
  16. punkweb_bb/static/punkweb_bb/css/shoutbox.css +13 -2
  17. punkweb_bb/static/punkweb_bb/css/subcategory-form.css +24 -0
  18. punkweb_bb/static/punkweb_bb/css/subcategory.css +12 -0
  19. punkweb_bb/static/punkweb_bb/css/thread.css +20 -1
  20. punkweb_bb/static/punkweb_bb/css/variables.css +1 -0
  21. punkweb_bb/static/punkweb_bb/editor/bbcode-editor.js +1 -1
  22. punkweb_bb/templates/punkweb_bb/base.html +6 -0
  23. punkweb_bb/templates/punkweb_bb/category_create.html +50 -0
  24. punkweb_bb/templates/punkweb_bb/category_update.html +53 -0
  25. punkweb_bb/templates/punkweb_bb/index.html +43 -2
  26. punkweb_bb/templates/punkweb_bb/login.html +1 -0
  27. punkweb_bb/templates/punkweb_bb/members.html +1 -0
  28. punkweb_bb/templates/punkweb_bb/partials/category_delete.html +11 -0
  29. punkweb_bb/templates/punkweb_bb/partials/shout_delete.html +11 -0
  30. punkweb_bb/templates/punkweb_bb/partials/subcategory_delete.html +11 -0
  31. punkweb_bb/templates/punkweb_bb/profile.html +1 -0
  32. punkweb_bb/templates/punkweb_bb/settings.html +1 -0
  33. punkweb_bb/templates/punkweb_bb/shoutbox/shout_list.html +18 -4
  34. punkweb_bb/templates/punkweb_bb/signup.html +1 -0
  35. punkweb_bb/templates/punkweb_bb/subcategory.html +31 -6
  36. punkweb_bb/templates/punkweb_bb/subcategory_create.html +53 -0
  37. punkweb_bb/templates/punkweb_bb/subcategory_update.html +56 -0
  38. punkweb_bb/templates/punkweb_bb/thread.html +94 -22
  39. punkweb_bb/templates/punkweb_bb/thread_create.html +2 -0
  40. punkweb_bb/templatetags/__pycache__/can_delete.cpython-311.pyc +0 -0
  41. punkweb_bb/templatetags/__pycache__/can_edit.cpython-311.pyc +0 -0
  42. punkweb_bb/templatetags/__pycache__/can_post.cpython-311.pyc +0 -0
  43. punkweb_bb/templatetags/can_delete.py +8 -0
  44. punkweb_bb/templatetags/can_edit.py +8 -0
  45. punkweb_bb/templatetags/can_post.py +8 -0
  46. punkweb_bb/tests.py +5 -5
  47. punkweb_bb/urls.py +29 -0
  48. punkweb_bb/utils.py +17 -0
  49. punkweb_bb/views.py +258 -45
  50. {punkweb_bb-0.1.4.dist-info → punkweb_bb-0.2.1.dist-info}/METADATA +2 -2
  51. {punkweb_bb-0.1.4.dist-info → punkweb_bb-0.2.1.dist-info}/RECORD +54 -35
  52. {punkweb_bb-0.1.4.dist-info → punkweb_bb-0.2.1.dist-info}/LICENSE +0 -0
  53. {punkweb_bb-0.1.4.dist-info → punkweb_bb-0.2.1.dist-info}/WHEEL +0 -0
  54. {punkweb_bb-0.1.4.dist-info → punkweb_bb-0.2.1.dist-info}/top_level.txt +0 -0
Binary file
punkweb_bb/forms.py CHANGED
@@ -1,7 +1,7 @@
1
1
  from django import forms
2
2
  from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
3
3
 
4
- from punkweb_bb.models import BoardProfile, Post, Shout, Thread
4
+ from punkweb_bb.models import BoardProfile, Category, Post, Shout, Subcategory, Thread
5
5
  from punkweb_bb.widgets import BBCodeEditorWidget
6
6
 
7
7
 
@@ -43,6 +43,21 @@ class BoardProfileModelForm(forms.ModelForm):
43
43
  }
44
44
 
45
45
 
46
+ class CategoryModelForm(forms.ModelForm):
47
+ class Meta:
48
+ model = Category
49
+ fields = (
50
+ "name",
51
+ "order",
52
+ )
53
+ widgets = {
54
+ "name": forms.TextInput(attrs={"autofocus": True, "class": "pw-input"}),
55
+ "order": forms.TextInput(
56
+ attrs={"class": "pw-input", "min": "0", "type": "number"}
57
+ ),
58
+ }
59
+
60
+
46
61
  class PostModelForm(forms.ModelForm):
47
62
  class Meta:
48
63
  model = Post
@@ -55,6 +70,30 @@ class PostModelForm(forms.ModelForm):
55
70
  }
56
71
 
57
72
 
73
+ class ShoutModelForm(forms.ModelForm):
74
+ class Meta:
75
+ model = Shout
76
+ fields = ("content",)
77
+
78
+
79
+ class SubcategoryModelForm(forms.ModelForm):
80
+ class Meta:
81
+ model = Subcategory
82
+ fields = (
83
+ "name",
84
+ "description",
85
+ "order",
86
+ "staff_post_only",
87
+ )
88
+ widgets = {
89
+ "name": forms.TextInput(attrs={"autofocus": True, "class": "pw-input"}),
90
+ "description": BBCodeEditorWidget(),
91
+ "order": forms.TextInput(
92
+ attrs={"class": "pw-input", "min": "0", "type": "number"}
93
+ ),
94
+ }
95
+
96
+
58
97
  class ThreadModelForm(forms.ModelForm):
59
98
  class Meta:
60
99
  model = Thread
@@ -66,9 +105,3 @@ class ThreadModelForm(forms.ModelForm):
66
105
  "title": forms.TextInput(attrs={"autofocus": True, "class": "pw-input"}),
67
106
  "content": BBCodeEditorWidget(),
68
107
  }
69
-
70
-
71
- class ShoutModelForm(forms.ModelForm):
72
- class Meta:
73
- model = Shout
74
- fields = ("content",)
@@ -0,0 +1,23 @@
1
+ # Generated by Django 4.2.11 on 2024-05-29 01:03
2
+
3
+ from django.db import migrations
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("punkweb_bb", "0002_thread_view_count"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterModelOptions(
14
+ name="thread",
15
+ options={
16
+ "ordering": ("subcategory", "-is_pinned", "-last_post_created_at"),
17
+ "permissions": (
18
+ ("pin_thread", "Can pin thread"),
19
+ ("close_thread", "Can close thread"),
20
+ ),
21
+ },
22
+ ),
23
+ ]
punkweb_bb/models.py CHANGED
@@ -79,6 +79,9 @@ class Subcategory(UUIDPrimaryKeyMixin, TimestampMixin):
79
79
  "order",
80
80
  )
81
81
 
82
+ def can_post(self, user):
83
+ return not self.staff_post_only or user.is_staff
84
+
82
85
  @property
83
86
  def thread_count(self):
84
87
  return self.threads.count()
@@ -116,10 +119,23 @@ class Thread(UUIDPrimaryKeyMixin, TimestampMixin):
116
119
  "-is_pinned",
117
120
  "-last_post_created_at",
118
121
  )
122
+ permissions = (
123
+ ("pin_thread", "Can pin thread"),
124
+ ("close_thread", "Can close thread"),
125
+ )
119
126
 
120
127
  def __str__(self):
121
128
  return f"{self.title}"
122
129
 
130
+ def can_edit(self, user):
131
+ return user == self.user or user.has_perm("punkweb_bb.change_thread")
132
+
133
+ def can_delete(self, user):
134
+ return user == self.user or user.has_perm("punkweb_bb.delete_thread")
135
+
136
+ def can_post(self, user):
137
+ return not self.is_closed
138
+
123
139
  @property
124
140
  def post_count(self):
125
141
  return self.posts.count()
@@ -143,6 +159,12 @@ class Post(UUIDPrimaryKeyMixin, TimestampMixin):
143
159
  def __str__(self):
144
160
  return f"{self.thread} > {self.user} > {self.created_at}"
145
161
 
162
+ def can_edit(self, user):
163
+ return user == self.user or user.has_perm("punkweb_bb.change_post")
164
+
165
+ def can_delete(self, user):
166
+ return user == self.user or user.has_perm("punkweb_bb.delete_post")
167
+
146
168
  @property
147
169
  def index(self):
148
170
  # Returns the index of the post in the thread, starting with 1
@@ -180,3 +202,6 @@ class Shout(UUIDPrimaryKeyMixin, TimestampMixin):
180
202
 
181
203
  def __str__(self):
182
204
  return f"{self.user} > {self.created_at}"
205
+
206
+ def can_delete(self, user):
207
+ return user == self.user or user.has_perm("punkweb_bb.delete_shout")
punkweb_bb/settings.py CHANGED
@@ -5,6 +5,7 @@ PUNKWEB_BB = getattr(settings, "PUNKWEB_BB", {})
5
5
  SITE_NAME = PUNKWEB_BB.get("SITE_NAME", "PUNKWEB")
6
6
  SITE_TITLE = PUNKWEB_BB.get("SITE_TITLE", "PunkwebBB")
7
7
  FAVICON = PUNKWEB_BB.get("FAVICON", "punkweb_bb/favicon.ico")
8
+ OG_IMAGE = PUNKWEB_BB.get("OG_IMAGE", None)
8
9
  SHOUTBOX_ENABLED = PUNKWEB_BB.get("SHOUTBOX_ENABLED", True)
9
10
  DISCORD_WIDGET_ENABLED = PUNKWEB_BB.get("DISCORD_WIDGET_ENABLED", False)
10
11
  DISCORD_WIDGET_THEME = PUNKWEB_BB.get("DISCORD_WIDGET_THEME", "dark")
@@ -0,0 +1,24 @@
1
+ .categoryForm {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 1rem;
5
+ }
6
+
7
+ .categoryForm__field {
8
+ align-items: start;
9
+ display: flex;
10
+ flex-direction: column;
11
+ gap: 0.5rem;
12
+ }
13
+
14
+ .categoryForm .errorlist {
15
+ color: var(--oc-red-9);
16
+ margin: 0;
17
+ }
18
+
19
+ .categoryForm__actions {
20
+ align-items: center;
21
+ display: flex;
22
+ justify-content: flex-end;
23
+ gap: 1rem;
24
+ }
@@ -7,6 +7,12 @@
7
7
  flex: 1;
8
8
  }
9
9
 
10
+ .index__category__title {
11
+ align-items: center;
12
+ display: flex;
13
+ gap: 0.5rem;
14
+ }
15
+
10
16
  .index__sidebar {
11
17
  flex: 0 0 20rem;
12
18
  }
@@ -390,12 +390,13 @@ blockquote cite {
390
390
  /** Icon Button **/
391
391
 
392
392
  .pw-icon-button {
393
+ align-items: center;
393
394
  border-radius: 0.25rem;
394
395
  cursor: pointer;
395
- display: inline-block;
396
+ display: flex;
397
+ justify-content: center;
396
398
  font-weight: 500;
397
399
  transition: all 0.15s ease;
398
- text-align: center;
399
400
 
400
401
  height: 2rem;
401
402
  line-height: 2rem;
@@ -406,6 +407,67 @@ blockquote cite {
406
407
  width: 2rem;
407
408
  }
408
409
 
410
+ .pw-icon-button .material-symbols-outlined {
411
+ display: block;
412
+ font-size: 1.125rem;
413
+ }
414
+
415
+ .pw-icon-button.xs {
416
+ height: 1rem;
417
+ line-height: 1rem;
418
+ max-height: 1rem;
419
+ max-width: 1rem;
420
+ min-height: 1rem;
421
+ min-width: 1rem;
422
+ width: 1rem;
423
+ }
424
+
425
+ .pw-icon-button.xs .material-symbols-outlined {
426
+ font-size: 0.875rem;
427
+ }
428
+
429
+ .pw-icon-button.sm {
430
+ height: 1.5rem;
431
+ line-height: 1.5rem;
432
+ max-height: 1.5rem;
433
+ max-width: 1.5rem;
434
+ min-height: 1.5rem;
435
+ min-width: 1.5rem;
436
+ width: 1.5rem;
437
+ }
438
+
439
+ .pw-icon-button.sm .material-symbols-outlined {
440
+ font-size: 1rem;
441
+ }
442
+
443
+ .pw-icon-button.lg {
444
+ height: 2.5rem;
445
+ line-height: 2.5rem;
446
+ max-height: 2.5rem;
447
+ max-width: 2.5rem;
448
+ min-height: 2.5rem;
449
+ min-width: 2.5rem;
450
+ width: 2.5rem;
451
+ }
452
+
453
+ .pw-icon-button.lg .material-symbols-outlined {
454
+ font-size: 1.25rem;
455
+ }
456
+
457
+ .pw-icon-button.xl {
458
+ height: 3rem;
459
+ line-height: 3rem;
460
+ max-height: 3rem;
461
+ max-width: 3rem;
462
+ min-height: 3rem;
463
+ min-width: 3rem;
464
+ width: 3rem;
465
+ }
466
+
467
+ .pw-icon-button.xl .material-symbols-outlined {
468
+ font-size: 1.5rem;
469
+ }
470
+
409
471
  .pw-icon-button:disabled {
410
472
  background-color: var(--oc-gray-5) !important;
411
473
  border-color: var(--oc-gray-5) !important;
@@ -413,11 +475,6 @@ blockquote cite {
413
475
  cursor: not-allowed;
414
476
  }
415
477
 
416
- .pw-icon-button .material-symbols-outlined {
417
- display: block;
418
- font-size: 1.125rem;
419
- }
420
-
421
478
  .pw-icon-button.rounded {
422
479
  border-radius: 100%;
423
480
  }
@@ -436,6 +493,30 @@ blockquote cite {
436
493
  background-color: var(--oc-gray-1);
437
494
  }
438
495
 
496
+ .pw-icon-button.default.primary {
497
+ color: var(--primary-9);
498
+ }
499
+
500
+ .pw-icon-button.default.primary:hover {
501
+ background-color: var(--primary-0);
502
+ }
503
+
504
+ .pw-icon-button.default.primary:active {
505
+ background-color: var(--primary-1);
506
+ }
507
+
508
+ .pw-icon-button.default.danger {
509
+ color: var(--oc-red-9);
510
+ }
511
+
512
+ .pw-icon-button.default.danger:hover {
513
+ background-color: var(--oc-red-0);
514
+ }
515
+
516
+ .pw-icon-button.default.danger:active {
517
+ background-color: var(--oc-red-1);
518
+ }
519
+
439
520
  /* Outlined */
440
521
 
441
522
  .pw-icon-button.outlined {
@@ -451,7 +532,33 @@ blockquote cite {
451
532
  background-color: var(--oc-gray-1);
452
533
  }
453
534
 
454
- /* Outlined */
535
+ .pw-icon-button.outlined.primary {
536
+ border-color: var(--primary-9);
537
+ color: var(--primary-9);
538
+ }
539
+
540
+ .pw-icon-button.outlined.primary:hover {
541
+ background-color: var(--primary-0);
542
+ }
543
+
544
+ .pw-icon-button.outlined.primary:active {
545
+ background-color: var(--primary-1);
546
+ }
547
+
548
+ .pw-icon-button.outlined.danger {
549
+ border-color: var(--oc-red-9);
550
+ color: var(--oc-red-9);
551
+ }
552
+
553
+ .pw-icon-button.outlined.danger:hover {
554
+ background-color: var(--oc-red-0);
555
+ }
556
+
557
+ .pw-icon-button.outlined.danger:active {
558
+ background-color: var(--oc-red-1);
559
+ }
560
+
561
+ /* Ghost */
455
562
 
456
563
  .pw-icon-button.ghost {
457
564
  border: 1px solid var(--oc-gray-9);
@@ -469,6 +576,38 @@ blockquote cite {
469
576
  color: white;
470
577
  }
471
578
 
579
+ .pw-icon-button.ghost.primary {
580
+ border: 1px solid var(--primary-9);
581
+ color: var(--primary-9);
582
+ }
583
+
584
+ .pw-icon-button.ghost.primary:not(:disabled):hover {
585
+ background-color: var(--primary-9);
586
+ color: white;
587
+ }
588
+
589
+ .pw-icon-button.ghost.primary:not(:disabled):active {
590
+ background-color: var(--primary-9);
591
+ box-shadow: 0 0.125rem 0.25rem 0 rgba(0, 0, 0, 0.25);
592
+ color: white;
593
+ }
594
+
595
+ .pw-icon-button.ghost.danger {
596
+ border: 1px solid var(--oc-red-9);
597
+ color: var(--oc-red-9);
598
+ }
599
+
600
+ .pw-icon-button.ghost.danger:not(:disabled):hover {
601
+ background-color: var(--oc-red-9);
602
+ color: white;
603
+ }
604
+
605
+ .pw-icon-button.ghost.danger:not(:disabled):active {
606
+ background-color: var(--oc-red-9);
607
+ box-shadow: 0 0.125rem 0.25rem 0 rgba(0, 0, 0, 0.25);
608
+ color: white;
609
+ }
610
+
472
611
  /* Raised */
473
612
 
474
613
  .pw-icon-button.raised {
@@ -477,6 +616,14 @@ blockquote cite {
477
616
  color: white;
478
617
  }
479
618
 
619
+ .pw-icon-button.raised.primary {
620
+ background-color: var(--primary-9);
621
+ }
622
+
623
+ .pw-icon-button.raised.danger {
624
+ background-color: var(--oc-red-9);
625
+ }
626
+
480
627
  .pw-icon-button.raised:not(:disabled):hover {
481
628
  box-shadow: 0 0.125rem 0.25rem 0 rgba(0, 0, 0, 0.25);
482
629
  }
@@ -3,16 +3,27 @@
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  height: 12rem;
6
- gap: 0.25rem;
7
6
  overflow-y: auto;
8
- padding: 1rem;
9
7
  }
10
8
 
11
9
  .shoutbox__shout {
10
+ align-items: center;
11
+ display: flex;
12
+ justify-content: space-between;
12
13
  font-size: 0.75rem;
14
+ padding: 0.25rem 1rem;
13
15
  white-space: wrap;
14
16
  }
15
17
 
18
+ .shoutbox__shout:hover {
19
+ background-color: var(--oc-gray-1);
20
+ }
21
+
22
+ .shoutbox__shout__actions {
23
+ align-items: center;
24
+ display: flex;
25
+ }
26
+
16
27
  .shoutbox__form {
17
28
  padding: 0.5rem 0;
18
29
  }
@@ -0,0 +1,24 @@
1
+ .subcategoryForm {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 1rem;
5
+ }
6
+
7
+ .subcategoryForm__field {
8
+ align-items: start;
9
+ display: flex;
10
+ flex-direction: column;
11
+ gap: 0.5rem;
12
+ }
13
+
14
+ .subcategoryForm .errorlist {
15
+ color: var(--oc-red-9);
16
+ margin: 0;
17
+ }
18
+
19
+ .subcategoryForm__actions {
20
+ align-items: center;
21
+ display: flex;
22
+ justify-content: flex-end;
23
+ gap: 1rem;
24
+ }
@@ -5,6 +5,18 @@
5
5
  margin: 2rem 0;
6
6
  }
7
7
 
8
+ .subcategory__header__name {
9
+ align-items: center;
10
+ display: flex;
11
+ gap: 1rem;
12
+ }
13
+
14
+ .subcategory__header__actions {
15
+ align-items: center;
16
+ display: flex;
17
+ gap: 0.5rem;
18
+ }
19
+
8
20
  .thread__title {
9
21
  align-items: center;
10
22
  display: flex;
@@ -55,6 +55,25 @@
55
55
  color: var(--body-fg);
56
56
  }
57
57
 
58
+ .thread__user__groups {
59
+ display: flex;
60
+ flex-direction: column;
61
+ gap: 0.5rem;
62
+ width: 100%;
63
+ }
64
+
65
+ .thread__user__group {
66
+ background-color: var(--primary-8);
67
+ border: 1px solid var(--primary-9);
68
+ border-radius: 0.25rem;
69
+ color: var(--text-on-primary);
70
+ display: flex;
71
+ font-size: 0.875rem;
72
+ justify-content: center;
73
+ padding: 0.5rem;
74
+ width: 100%;
75
+ }
76
+
58
77
  .thread__main {
59
78
  display: flex;
60
79
  flex-direction: column;
@@ -75,7 +94,7 @@
75
94
  align-items: center;
76
95
  display: flex;
77
96
  justify-content: flex-end;
78
- gap: 1rem;
97
+ gap: 0.25rem;
79
98
  padding: 1rem;
80
99
  }
81
100
 
@@ -12,6 +12,7 @@
12
12
 
13
13
  --text-dark: var(--oc-gray-9);
14
14
  --text-light: var(--oc-gray-0);
15
+ --text-on-primary: var(--oc-gray-0);
15
16
 
16
17
  --body-bg: var(--oc-white);
17
18
  --body-fg: var(--text-dark);
@@ -2,7 +2,7 @@ $(function () {
2
2
  $(document).ready(function () {
3
3
  $(".bbcode-editor").sceditor({
4
4
  emoticonsCompat: true,
5
- emoticonsEnabled: true,
5
+ emoticonsEnabled: false,
6
6
  emoticonsRoot: "/media/precise_bbcode/smilies/",
7
7
  emoticons: {
8
8
  dropdown: {},
@@ -6,6 +6,12 @@
6
6
  <meta charset="UTF-8" />
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <title>{% block title_prefix %}{% endblock %}{{ punkweb_bb.settings.SITE_TITLE|default:"PunkwebBB" }}</title>
9
+ <meta property="og:title" content="{% block og_title_prefix %}{% endblock %}{{ punkweb_bb.settings.SITE_TITLE|default:"PunkwebBB" }}" />
10
+ <meta property="og:type" content="website" />
11
+ <meta property="og:url" content="{{ request.build_absolute_uri }}" />
12
+ {% if punkweb_bb.settings.OG_IMAGE %}
13
+ <meta property="og:image" content="{{ punkweb_bb.settings.OG_IMAGE }}" />
14
+ {% endif %}
9
15
  <link rel="icon" href="{% static punkweb_bb.settings.FAVICON %}" />
10
16
  <link rel="stylesheet" href="{% static 'punkweb_bb/vendor/open-color.css' %}" />
11
17
  <link rel="stylesheet" href="{% static 'punkweb_bb/vendor/prism.css' %}" />
@@ -0,0 +1,50 @@
1
+ {% extends 'punkweb_bb/base.html' %}
2
+ {% load static %}
3
+
4
+ {% block title_prefix %}Create Category | {% endblock %}
5
+
6
+ {% block extra_head %}
7
+ {{form.media.css}}
8
+ <link rel="stylesheet" href="{% static 'punkweb_bb/css/category-form.css' %}" />
9
+ {% endblock %}
10
+
11
+ {% block content %}
12
+
13
+ <nav>
14
+ <ul class="pw-breadcrumb">
15
+ <li class="pw-breadcrumb-item">
16
+ <a href="{% url 'punkweb_bb:index' %}">Home</a>
17
+ </li>
18
+ <li class="pw-breadcrumb-item active">
19
+ Create Category
20
+ </li>
21
+ </ul>
22
+ </nav>
23
+
24
+ <div class="pw-card fluid">
25
+ <div class="pw-card-header">Create Category</div>
26
+ <div class="pw-card-content">
27
+ <form class="categoryForm" action="{% url 'punkweb_bb:category_create' %}" method="post">
28
+ {% csrf_token %}
29
+ {% for field in form %}
30
+ <div class="categoryForm__field">
31
+ <label class="pw-input-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
32
+ {{ field }}
33
+ </div>
34
+ {% endfor %}
35
+ {% if form.non_field_errors %}
36
+ {{ form.non_field_errors }}
37
+ {% endif %}
38
+ <div class="categoryForm__actions">
39
+ <a class="pw-button default" href="{% url 'punkweb_bb:index' %}" type="submit">Cancel</a>
40
+ <button class="pw-button raised primary" type="submit">Create</button>
41
+ </div>
42
+ </form>
43
+ </div>
44
+ </div>
45
+
46
+ {% endblock %}
47
+
48
+ {% block extra_script %}
49
+ {{form.media.js}}
50
+ {% endblock %}
@@ -0,0 +1,53 @@
1
+ {% extends 'punkweb_bb/base.html' %}
2
+ {% load static %}
3
+
4
+ {% block title_prefix %}Edit Category | {% endblock %}
5
+
6
+ {% block extra_head %}
7
+ {{form.media.css}}
8
+ <link rel="stylesheet" href="{% static 'punkweb_bb/css/category-form.css' %}" />
9
+ {% endblock %}
10
+
11
+ {% block content %}
12
+
13
+ <nav>
14
+ <ul class="pw-breadcrumb">
15
+ <li class="pw-breadcrumb-item">
16
+ <a href="{% url 'punkweb_bb:index' %}">Home</a>
17
+ </li>
18
+ <li class="pw-breadcrumb-item">
19
+ <a href="{{category.get_absolute_url}}">{{category.name}}</a>
20
+ </li>
21
+ <li class="pw-breadcrumb-item active">
22
+ Edit
23
+ </li>
24
+ </ul>
25
+ </nav>
26
+
27
+ <div class="pw-card fluid">
28
+ <div class="pw-card-header">Edit Category</div>
29
+ <div class="pw-card-content">
30
+ <form class="categoryForm" action="{% url 'punkweb_bb:category_update' category.slug %}" method="post">
31
+ {% csrf_token %}
32
+ {% for field in form %}
33
+ <div class="categoryForm__field">
34
+ <label class="pw-input-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
35
+ {{ field }}
36
+ </div>
37
+ {% endfor %}
38
+ {% if form.non_field_errors %}
39
+ {{ form.non_field_errors }}
40
+ {% endif %}
41
+ <div class="categoryForm__actions">
42
+ <a class="pw-button default" href="{{category.get_absolute_url}}">Cancel</a>
43
+ <button class="pw-button raised primary" type="submit">Save</button>
44
+ </div>
45
+ </form>
46
+ </div>
47
+ </div>
48
+
49
+ {% endblock %}
50
+
51
+ {% block extra_script %}
52
+ {{form.media.js}}
53
+ {% endblock %}