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
fb4a5bfc
Commit
fb4a5bfc
authored
May 09, 2023
by
Julia Anishka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated views, url and created template for add new announcement page
parent
e2232aac
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
announcement-add.html
...ntboard/templates/announcementboard/announcement-add.html
+13
-0
urls.py
widget_princessgabi/announcementboard/urls.py
+4
-0
views.py
widget_princessgabi/announcementboard/views.py
+7
-0
No files found.
widget_princessgabi/announcementboard/templates/announcementboard/announcement-add.html
0 → 100644
View file @
fb4a5bfc
{% extends 'base.html' %}
{% block title %} Add Announcement {% endblock %}
{% block header %}
<h1>
Add a new announcement:
</h1>
{% endblock %}
{% block body %}
<form
method=
'POST'
>
{% csrf_token %}
{{ form }}
<input
type=
"Submit"
value=
"Add Announcement"
>
</form>
{% endblock %}
\ No newline at end of file
widget_princessgabi/announcementboard/urls.py
View file @
fb4a5bfc
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.
import
views
from
.views
import
(
AnnouncementsCreateView
,
)
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
announcement_view
,
name
=
'announcements'
),
path
(
''
,
views
.
announcement_view
,
name
=
'announcements'
),
path
(
'announcements/add/'
,
AnnouncementsCreateView
.
as_view
(),
name
=
'announcement-add'
),
]
]
widget_princessgabi/announcementboard/views.py
View file @
fb4a5bfc
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.views.generic.edit
import
CreateView
from
.models
import
Announcement
,
Reaction
from
.models
import
Announcement
,
Reaction
def
announcement_view
(
request
):
def
announcement_view
(
request
):
...
@@ -9,3 +11,8 @@ def announcement_view(request):
...
@@ -9,3 +11,8 @@ def announcement_view(request):
'announcements'
:
announcements
'announcements'
:
announcements
}
}
return
render
(
request
,
'announcementboard/announcements.html'
,
context
)
return
render
(
request
,
'announcementboard/announcements.html'
,
context
)
class
AnnouncementsCreateView
(
CreateView
):
model
=
Announcement
template_name
=
'announcementboard/announcement-add.html'
fields
=
'__all__'
\ 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