Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_k3git
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
Stefan Gomez
midterm_k3git
Commits
eb68ea90
Commit
eb68ea90
authored
May 15, 2023
by
MJoshBen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented Add New Announcement Page
parent
77dbe756
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
3 deletions
+24
-3
announcement-add.html
...announcement/templates/announcement/announcement-add.html
+14
-0
urls.py
widget_k3git/announcement/urls.py
+3
-2
views.py
widget_k3git/announcement/views.py
+7
-1
No files found.
widget_k3git/announcement/templates/announcement/announcement-add.html
0 → 100644
View file @
eb68ea90
{% extends 'base.html' %}
{% block title %}Add Announcement{% endblock %}
{% block content %}
<h1>
Add a new announcement:
</h1><br>
<form
action=
""
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save New Announcement"
>
</form>
{% endblock %}
{% block scripts %}
{% endblock %}
widget_k3git/announcement/urls.py
View file @
eb68ea90
from
django.contrib
import
admin
from
django.contrib
import
admin
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
,
AnnouncementDetailView
from
.views
import
index
,
AnnouncementDetailView
,
AnnouncementCreateView
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
index
,
name
=
'index'
),
path
(
'<int:pk>/details'
,
AnnouncementDetailView
.
as_view
(),
name
=
'announcement-details'
)
path
(
'<int:pk>/details'
,
AnnouncementDetailView
.
as_view
(),
name
=
'announcement-details'
),
path
(
'add/'
,
AnnouncementCreateView
.
as_view
(),
name
=
'add-announcement'
)
]
]
app_name
=
"announcement"
app_name
=
"announcement"
widget_k3git/announcement/views.py
View file @
eb68ea90
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
from
.models
import
Announcement
,
Reaction
from
.models
import
Announcement
def
index
(
request
):
def
index
(
request
):
return
render
(
request
,
'announcement/announcement.html'
,
{
'announcement'
:
Announcement
.
objects
.
all
()})
return
render
(
request
,
'announcement/announcement.html'
,
{
'announcement'
:
Announcement
.
objects
.
all
()})
...
@@ -11,4 +12,9 @@ class AnnouncementDetailView(DetailView):
...
@@ -11,4 +12,9 @@ class AnnouncementDetailView(DetailView):
def
get
(
self
,
request
,
pk
):
def
get
(
self
,
request
,
pk
):
return
render
(
request
,
'announcement/announcement-details.html'
,
{
'announcement'
:
self
.
model
.
objects
.
get
(
pk
=
pk
)})
return
render
(
request
,
'announcement/announcement-details.html'
,
{
'announcement'
:
self
.
model
.
objects
.
get
(
pk
=
pk
)})
class
AnnouncementCreateView
(
CreateView
):
model
=
Announcement
fields
=
'__all__'
template_name
=
'announcement/announcement-add.html'
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