Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
final_quintupoltrobol
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
Matthew Karl David P. Arpas
final_quintupoltrobol
Commits
f0c42122
Commit
f0c42122
authored
May 14, 2023
by
Michael Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tried fixing the announcement-edit and announcement-add.html
parent
b6995a3c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
21 additions
and
25 deletions
+21
-25
urls.cpython-39.pyc
...tupoltrobol/announcements/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
...upoltrobol/announcements/__pycache__/views.cpython-39.pyc
+0
-0
announcement-add.html
...nouncements/templates/announcements/announcement-add.html
+3
-3
announcement-detail.html
...ncements/templates/announcements/announcement-detail.html
+2
-3
announcement-edit.html
...ouncements/templates/announcements/announcement-edit.html
+6
-7
announcements.html
.../announcements/templates/announcements/announcements.html
+1
-1
urls.py
widget_quintupoltrobol/announcements/urls.py
+1
-1
views.py
widget_quintupoltrobol/announcements/views.py
+8
-10
db.sqlite3
widget_quintupoltrobol/db.sqlite3
+0
-0
No files found.
widget_quintupoltrobol/announcements/__pycache__/urls.cpython-39.pyc
View file @
f0c42122
No preview for this file type
widget_quintupoltrobol/announcements/__pycache__/views.cpython-39.pyc
View file @
f0c42122
No preview for this file type
widget_quintupoltrobol/announcements/templates/announcements/announcement-add.html
View file @
f0c42122
{% extends "base.html" %}
{% load static %}
{% block title %}
Add Announcement
{% endblock %}
...
...
@@ -8,7 +8,7 @@ Add Announcement
<h2>
Add a new announcement:
</h2>
<p>
<form
action=
''
method=
"POST
"
>
<form
action=
"{% url 'announcements:announcement_details' %}"
method=
"post
"
>
{% csrf_token %}
<p>
Title: {{form.title}}
</p><br>
<p>
Body:
<br>
{{form.body}}
</p><br>
...
...
@@ -17,4 +17,4 @@ Add Announcement
</form>
</p>
{% endblock %}
\ No newline at end of file
{% endblock %}
widget_quintupoltrobol/announcements/templates/announcements/announcement-detail.html
View file @
f0c42122
...
...
@@ -15,7 +15,6 @@
Love: {{love_count}}
<br><br>
Angry: {{angry_count}}
</p>
<br>
<form
method=
"get"
action=
"{% url 'announcements:announcement_edit' pk=object.pk %}"
>
<button
type=
"submit"
>
Edit Announcement
</button>
</form>
<button>
<a
href=
"{% url 'announcements:announcement_edit' object.pk %}"
>
Edit Announcement
</a></button>
{% endblock %}
\ No newline at end of file
widget_quintupoltrobol/announcements/templates/announcements/announcement-edit.html
View file @
f0c42122
...
...
@@ -2,14 +2,13 @@
{% load static %}
{% block title %} Edit Announcement {% endblock %}
{% block content %}
<h2>
Edit announcement:
</h2>
<p>
<form
action=
''
method=
"POST"
>
<form
method=
"post"
action=
""
>
{% csrf_token %}
<p>
Title: {{form.title}}
</p><br>
<p>
Body:
<br>
{{form.body}}
</p><br>
<p>
Author: {{form.author}}
</p><br>
<input
type=
"submit"
value=
"Save Changes to Announcement"
>
</form>
</p>
{% endblock %}
\ No newline at end of file
<input
type=
"submit"
value=
"Save Changes to Announcements"
>
</form>
{% endblock %}
widget_quintupoltrobol/announcements/templates/announcements/announcements.html
View file @
f0c42122
{% extends "base.html" %}
{% load static %}
{% block title %}
Widget's Announcement Board
{% endblock %}
...
...
widget_quintupoltrobol/announcements/urls.py
View file @
f0c42122
from
django.urls
import
path
from
.views
import
*
from
.views
import
pageview
,
AnnouncementDetailView
,
AnnouncementCreateView
,
AnnouncementEditView
urlpatterns
=
[
path
(
''
,
pageview
,
name
=
'pageview'
),
...
...
widget_quintupoltrobol/announcements/views.py
View file @
f0c42122
from
.forms
import
*
from
.forms
import
AddAnnouncement
from
.models
import
Announcement
,
Reaction
from
django.views.generic
import
ListView
,
DetailView
,
CreateView
,
UpdateView
from
django.db.models
import
Sum
from
django.shortcuts
import
render
from
django.urls
import
reverse
from
.models
import
Announcement
def
pageview
(
request
):
model_object
=
Announcement
.
objects
.
order_by
(
"-pub_datetime"
)
...
...
@@ -31,10 +32,7 @@ class AnnouncementCreateView(CreateView):
model
=
Announcement
form_class
=
AddAnnouncement
template_name
=
"announcements/announcement-add.html"
def
form_valid
(
self
,
form
):
response
=
super
()
.
form_valid
(
form
)
form
.
save
()
return
response
def
get_success_url
(
self
):
return
reverse
(
"announcements:announcement_details"
,
args
=
(
self
.
object
.
pk
,))
...
...
@@ -42,10 +40,10 @@ class AnnouncementEditView(UpdateView):
model
=
Announcement
form_class
=
AddAnnouncement
template_name
=
"announcements/announcement-edit.html"
def
form_valid
(
self
,
form
):
response
=
super
()
.
form_valid
(
form
)
form
.
save
()
return
response
def
get_success_url
(
self
):
return
reverse
(
"announcements:announcement_details"
,
args
=
(
self
.
object
.
pk
,))
return
reverse
(
"announcements:announcement_details"
,
kwargs
=
{
"pk"
:
self
.
object
.
pk
})
widget_quintupoltrobol/db.sqlite3
View file @
f0c42122
No preview for this file type
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