Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_princessgabi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ysabella Panghulan
midterm_princessgabi
Commits
92b62429
Commit
92b62429
authored
May 12, 2023
by
Julia Anishka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed url format of details, add and edit announcement
parent
8aa8eb3c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
9 deletions
+12
-9
models.py
widget_princessgabi/announcementboard/models.py
+5
-1
announcement-details.html
...ard/templates/announcementboard/announcement-details.html
+3
-4
announcements.html
...ementboard/templates/announcementboard/announcements.html
+1
-1
urls.py
widget_princessgabi/announcementboard/urls.py
+3
-3
No files found.
widget_princessgabi/announcementboard/models.py
View file @
92b62429
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
from
dashboard.models
import
WidgetUser
from
dashboard.models
import
WidgetUser
...
@@ -6,11 +7,14 @@ class Announcement(models.Model):
...
@@ -6,11 +7,14 @@ class Announcement(models.Model):
title
=
models
.
CharField
(
max_length
=
50
)
title
=
models
.
CharField
(
max_length
=
50
)
body
=
models
.
TextField
(
max_length
=
700
,
null
=
True
,
blank
=
True
)
body
=
models
.
TextField
(
max_length
=
700
,
null
=
True
,
blank
=
True
)
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
pub_datetime
=
models
.
DateTimeField
(
'publication date and time'
)
pub_datetime
=
models
.
DateTimeField
(
'publication date and time'
,
auto_now_add
=
True
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
title
return
self
.
title
def
get_absolute_url
(
self
):
return
reverse
(
'announcementboard:announcement-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
class
Reaction
(
models
.
Model
):
class
Reaction
(
models
.
Model
):
class
Choices
(
models
.
TextChoices
):
class
Choices
(
models
.
TextChoices
):
like
=
'Like'
like
=
'Like'
...
...
widget_princessgabi/announcementboard/templates/announcementboard/announcement-details.html
View file @
92b62429
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
{% block title %} {{ announcement.title }} {% endblock %}
{% block title %} {{ announcement.title }} {% endblock %}
{% block header %}
{% block header %}
<h1>
{{ announcement.title }}
</h1>
<h1>
{{ announcement.title }}
</h1>
{% endblock %}
{% endblock %}
{% block body %}
{% block body %}
...
@@ -14,6 +14,5 @@
...
@@ -14,6 +14,5 @@
<li>
Love: {{ tallies.love|default:0 }}
</li>
<li>
Love: {{ tallies.love|default:0 }}
</li>
<li>
Angry: {{ tallies.angry|default:0 }}
</li>
<li>
Angry: {{ tallies.angry|default:0 }}
</li>
</ul>
</ul>
<a
href=
"{% url 'announcementboard:announcement-edit' announcement.id %}"
>
Edit Announcement
</a>
<a
href=
"{{ announcement.get_absolute_url }}edit"
>
Edit Announcement
</a>
{% endblock %}
{% endblock %}
\ No newline at end of file
widget_princessgabi/announcementboard/templates/announcementboard/announcements.html
View file @
92b62429
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
</ul>
</ul>
</div>
</div>
<div>
<div>
<a
href=
"/announcements/a
nnouncements/a
dd/"
>
New Announcement
</a>
<a
href=
"/announcements/add/"
>
New Announcement
</a>
</div>
</div>
<a
href=
"/dashboard/"
>
Dashboard
</a>
<a
href=
"/dashboard/"
>
Dashboard
</a>
<a
href=
"/forum/"
>
Forum
</a>
<a
href=
"/forum/"
>
Forum
</a>
...
...
widget_princessgabi/announcementboard/urls.py
View file @
92b62429
...
@@ -5,9 +5,9 @@ from .views import (AnnouncementsDetailView, AnnouncementsUpdateView, Announceme
...
@@ -5,9 +5,9 @@ from .views import (AnnouncementsDetailView, AnnouncementsUpdateView, Announceme
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
announcement_view
,
name
=
'announcements'
),
path
(
''
,
views
.
announcement_view
,
name
=
'announcements'
),
path
(
'
announcements/
<int:pk>/details/'
,
AnnouncementsDetailView
.
as_view
(),
name
=
'announcement-details'
),
path
(
'<int:pk>/details/'
,
AnnouncementsDetailView
.
as_view
(),
name
=
'announcement-details'
),
path
(
'a
nnouncements/a
dd/'
,
AnnouncementsCreateView
.
as_view
(),
name
=
'announcement-add'
),
path
(
'add/'
,
AnnouncementsCreateView
.
as_view
(),
name
=
'announcement-add'
),
path
(
'
announcements/<int:pk>/details/edit/'
,
AnnouncementsUpdateView
.
as_view
(),
name
=
'announcement-edit'
)
path
(
'
<int:pk>/edit/'
,
AnnouncementsUpdateView
.
as_view
(),
name
=
'announcement-edit'
),
]
]
app_name
=
'announcementboard'
app_name
=
'announcementboard'
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment