Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_Alipins
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
Angelico Ruiz T. Teaño
widget_Alipins
Commits
e4182b16
Commit
e4182b16
authored
May 23, 2022
by
Carlo Joseph Echon
🐟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the redirect route after creation of new announcement, and changed add.html styling
parent
dd3024ee
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
6 deletions
+9
-6
models.py
widget_alipins/announcements/models.py
+1
-2
add.html
...et_alipins/announcements/templates/announcements/add.html
+6
-1
urls.py
widget_alipins/announcements/urls.py
+1
-1
views.py
widget_alipins/announcements/views.py
+1
-2
No files found.
widget_alipins/announcements/models.py
View file @
e4182b16
from
pickle
import
TRUE
from
django.db
import
models
from
django.db
import
models
from
homepage.models
import
WidgetUser
from
homepage.models
import
WidgetUser
from
django.urls
import
reverse
from
django.urls
import
reverse
...
@@ -17,7 +16,7 @@ class Announcement(models.Model):
...
@@ -17,7 +16,7 @@ class Announcement(models.Model):
return
self
.
announcement_title
return
self
.
announcement_title
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'announcements:indexAnnouncements'
)
return
u'
%
d/details'
%
self
.
pk
class
Reaction
(
models
.
Model
):
class
Reaction
(
models
.
Model
):
LIKE
=
"Like"
LIKE
=
"Like"
...
...
widget_alipins/announcements/templates/announcements/add.html
View file @
e4182b16
...
@@ -11,7 +11,12 @@
...
@@ -11,7 +11,12 @@
<div>
<div>
<form
method=
"POST"
,
enctype=
"multipart/form-data"
>
<form
method=
"POST"
,
enctype=
"multipart/form-data"
>
{% csrf_token %}
{% csrf_token %}
{{form.as_p}}
Announcement title: {{form.announcement_title}}
<br>
Announcement body:
<br>
{{form.announcement_body}}
<br>
Author: {{form.author}}
<br>
Image: {{form.announcement_image}}
<br>
<button>
Save Announcement
</button>
<button>
Save Announcement
</button>
</form>
</div>
</div>
{% endblock %}
{% endblock %}
\ No newline at end of file
widget_alipins/announcements/urls.py
View file @
e4182b16
...
@@ -6,5 +6,5 @@ app_name = "announcements"
...
@@ -6,5 +6,5 @@ app_name = "announcements"
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
"indexAnnouncements"
),
path
(
''
,
views
.
index
,
name
=
"indexAnnouncements"
),
path
(
'<int:announcement_id>/details'
,
views
.
details
,
name
=
"detailsAnnouncements"
),
path
(
'<int:announcement_id>/details'
,
views
.
details
,
name
=
"detailsAnnouncements"
),
path
(
'add
/
'
,
addAnnouncement
.
as_view
(),
name
=
"addAnnouncements"
),
path
(
'add'
,
addAnnouncement
.
as_view
(),
name
=
"addAnnouncements"
),
]
]
\ No newline at end of file
widget_alipins/announcements/views.py
View file @
e4182b16
from
multiprocessing
import
context
from
django.http
import
Http404
from
django.http
import
HttpResponse
,
Http404
from
.models
import
Announcement
,
Reaction
from
.models
import
Announcement
,
Reaction
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.views.generic
import
CreateView
from
django.views.generic
import
CreateView
...
...
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