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
fdbb6f84
Commit
fdbb6f84
authored
May 14, 2023
by
Migs Atienza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added forumpost-add.html
parent
9dd377bb
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
32 additions
and
2 deletions
+32
-2
db.sqlite3
widget_k3git/db.sqlite3
+0
-0
models.cpython-39.pyc
widget_k3git/forum/__pycache__/models.cpython-39.pyc
+0
-0
urls.cpython-39.pyc
widget_k3git/forum/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
widget_k3git/forum/__pycache__/views.cpython-39.pyc
+0
-0
models.py
widget_k3git/forum/models.py
+3
-0
forum.html
widget_k3git/forum/templates/forum/forum.html
+1
-1
forumpost-add.html
widget_k3git/forum/templates/forum/forumpost-add.html
+14
-0
urls.py
widget_k3git/forum/urls.py
+2
-1
views.py
widget_k3git/forum/views.py
+12
-0
No files found.
widget_k3git/db.sqlite3
View file @
fdbb6f84
No preview for this file type
widget_k3git/forum/__pycache__/models.cpython-39.pyc
View file @
fdbb6f84
No preview for this file type
widget_k3git/forum/__pycache__/urls.cpython-39.pyc
View file @
fdbb6f84
No preview for this file type
widget_k3git/forum/__pycache__/views.cpython-39.pyc
View file @
fdbb6f84
No preview for this file type
widget_k3git/forum/models.py
View file @
fdbb6f84
from
django.db
import
models
from
django.urls
import
reverse
class
ForumPost
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
100
)
body
=
models
.
TextField
(
max_length
=
1000
)
...
...
@@ -22,4 +23,6 @@ class Reply(models.Model):
def
__str__
(
self
):
return
'{}
\'
s reply to {}'
.
format
(
self
.
author
,
self
.
forum_post
)
# Create your models here.
widget_k3git/forum/templates/forum/forum.html
View file @
fdbb6f84
...
...
@@ -10,7 +10,7 @@
</h3>
{% endblock %}
{% block scripts %}
<a
href=
"/forum/forumposts/add"
><input
type=
"submit"
value=
"New Post"
></a><br><br>
<a
href=
"/dashboard"
>
Dashboard
</a><br>
<a
href=
"/announcement"
>
Announcements
</a><br>
<a
href=
"/assignments"
>
Assignments
</a><br>
...
...
widget_k3git/forum/templates/forum/forumpost-add.html
0 → 100644
View file @
fdbb6f84
{% extends 'base.html' %}
{% block title %}Add Post{% endblock %}
{% block content %}
<h1>
Add a new Post:
</h1>
<form
action=
""
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save New Post"
>
</form>
{% endblock %}
{% block scripts %}
{% endblock %}
\ No newline at end of file
widget_k3git/forum/urls.py
View file @
fdbb6f84
from
django.contrib
import
admin
from
django.urls
import
path
from
.views
import
index
,
ForumPostDetailView
from
.views
import
index
,
ForumPostDetailView
,
ForumPostCreateView
,
ForumPostUpdateView
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
'forumposts/<int:pk>/details'
,
ForumPostDetailView
.
as_view
(),
name
=
'forumpost-details'
),
path
(
'forumposts/add'
,
ForumPostCreateView
.
as_view
(),
name
=
'forumpost-add'
),
]
app_name
=
"forum"
\ No newline at end of file
widget_k3git/forum/views.py
View file @
fdbb6f84
...
...
@@ -16,4 +16,16 @@ class ForumPostDetailView(DetailView):
def
get
(
self
,
request
,
pk
):
return
render
(
request
,
'forum/forumpost-details.html'
,
{
'reply'
:
self
.
model
.
objects
.
get
(
pk
=
pk
)})
class
ForumPostCreateView
(
CreateView
):
model
=
ForumPost
fields
=
'__all__'
template_name
=
'forum/forumpost-add.html'
class
ForumPostUpdateView
(
UpdateView
):
model
=
ForumPost
fields
=
'__all__'
template_name
=
'forum/forumpost-edit.html'
# Create your views here.
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