Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_vincentdjango
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
1
Merge Requests
1
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
Almira Redoble
midterm_vincentdjango
Commits
68d03b5a
Commit
68d03b5a
authored
Mar 05, 2023
by
shibadisaster
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'forum' into main
parents
8fdc7d50
d56aa856
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
217 additions
and
2 deletions
+217
-2
.gitignore
.gitignore
+6
-1
0002_auto_20230305_1528.py
...o/announcementBoard/migrations/0002_auto_20230305_1528.py
+35
-0
views.py
widget_vincentdjango/announcementBoard/views.py
+1
-1
__init__.cpython-39.pyc
...ncentdjango/dashboard/__pycache__/__init__.cpython-39.pyc
+0
-0
admin.cpython-39.pyc
..._vincentdjango/dashboard/__pycache__/admin.cpython-39.pyc
+0
-0
apps.cpython-39.pyc
...t_vincentdjango/dashboard/__pycache__/apps.cpython-39.pyc
+0
-0
models.cpython-39.pyc
...vincentdjango/dashboard/__pycache__/models.cpython-39.pyc
+0
-0
__init__.py
widget_vincentdjango/forum/__init__.py
+0
-0
admin.py
widget_vincentdjango/forum/admin.py
+19
-0
apps.py
widget_vincentdjango/forum/apps.py
+6
-0
0001_initial.py
widget_vincentdjango/forum/migrations/0001_initial.py
+35
-0
0002_reply_post.py
widget_vincentdjango/forum/migrations/0002_reply_post.py
+19
-0
__init__.py
widget_vincentdjango/forum/migrations/__init__.py
+0
-0
models.py
widget_vincentdjango/forum/models.py
+43
-0
tests.py
widget_vincentdjango/forum/tests.py
+3
-0
urls.py
widget_vincentdjango/forum/urls.py
+11
-0
views.py
widget_vincentdjango/forum/views.py
+37
-0
settings.py
widget_vincentdjango/widget_vincentdjango/settings.py
+1
-0
urls.py
widget_vincentdjango/widget_vincentdjango/urls.py
+1
-0
No files found.
.gitignore
View file @
68d03b5a
<<<<<<< HEAD
# Byte-compiled / optimized / DLL files
# Byte-compiled / optimized / DLL files
__pycache__/
__pycache__/
*.py[cod]
*.py[cod]
...
@@ -158,3 +159,7 @@ cython_debug/
...
@@ -158,3 +159,7 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
#.idea/
=======
.env
*.pyc
>>>>>>> forum
widget_vincentdjango/announcementBoard/migrations/0002_auto_20230305_1528.py
0 → 100644
View file @
68d03b5a
# Generated by Django 3.2 on 2023-03-05 07:28
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'dashboard'
,
'0001_initial'
),
(
'announcementBoard'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'announcement'
,
name
=
'author'
,
field
=
models
.
ForeignKey
(
default
=
True
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'announcements'
,
to
=
'dashboard.widgetuser'
),
),
migrations
.
AlterField
(
model_name
=
'reaction'
,
name
=
'annoucement'
,
field
=
models
.
ForeignKey
(
default
=
True
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'reactions'
,
to
=
'announcementBoard.announcement'
),
),
migrations
.
AlterField
(
model_name
=
'reaction'
,
name
=
'name'
,
field
=
models
.
CharField
(
choices
=
[(
'Like'
,
'Like'
),
(
'Love'
,
'Love'
),
(
'Angry'
,
'Angry'
)],
default
=
'Like'
,
max_length
=
5
),
),
migrations
.
AlterField
(
model_name
=
'reaction'
,
name
=
'tally'
,
field
=
models
.
PositiveIntegerField
(
default
=
0
),
),
]
widget_vincentdjango/announcementBoard/views.py
View file @
68d03b5a
widget_vincentdjango/dashboard/__pycache__/__init__.cpython-39.pyc
0 → 100644
View file @
68d03b5a
File added
widget_vincentdjango/dashboard/__pycache__/admin.cpython-39.pyc
0 → 100644
View file @
68d03b5a
File added
widget_vincentdjango/dashboard/__pycache__/apps.cpython-39.pyc
0 → 100644
View file @
68d03b5a
File added
widget_vincentdjango/dashboard/__pycache__/models.cpython-39.pyc
0 → 100644
View file @
68d03b5a
File added
widget_vincentdjango/forum/__init__.py
0 → 100644
View file @
68d03b5a
widget_vincentdjango/forum/admin.py
0 → 100644
View file @
68d03b5a
from
django.contrib
import
admin
from
.models
import
ForumPost
,
Reply
class
ForumPostAdmin
(
admin
.
ModelAdmin
):
model
=
ForumPost
list_display
=
(
'title'
,
'body'
,
'author'
,
'pub_datetime'
)
search_fields
=
(
'title'
,
'author'
,
'pub_datetime'
,)
list_filter
=
(
'title'
,
'author'
,
'pub_datetime'
,)
class
ReplyAdmin
(
admin
.
ModelAdmin
):
model
=
Reply
list_display
=
(
'body'
,
'post'
,
'author'
,
'pub_datetime'
,)
search_fields
=
(
'author'
,
'pub_datetime'
,)
list_filter
=
(
'author'
,
'pub_datetime'
,)
admin
.
site
.
register
(
ForumPost
,
ForumPostAdmin
)
admin
.
site
.
register
(
Reply
,
ReplyAdmin
)
widget_vincentdjango/forum/apps.py
0 → 100644
View file @
68d03b5a
from
django.apps
import
AppConfig
class
ForumConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'forum'
widget_vincentdjango/forum/migrations/0001_initial.py
0 → 100644
View file @
68d03b5a
# Generated by Django 3.2 on 2023-03-05 07:28
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
(
'dashboard'
,
'0001_initial'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Reply'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'body'
,
models
.
CharField
(
max_length
=
200
)),
(
'pub_datetime'
,
models
.
DateTimeField
()),
(
'author'
,
models
.
ForeignKey
(
default
=
True
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'dashboard.widgetuser'
)),
],
),
migrations
.
CreateModel
(
name
=
'ForumPost'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'title'
,
models
.
CharField
(
max_length
=
100
)),
(
'body'
,
models
.
CharField
(
max_length
=
200
)),
(
'pub_datetime'
,
models
.
DateTimeField
()),
(
'author'
,
models
.
ForeignKey
(
default
=
True
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'dashboard.widgetuser'
)),
],
),
]
widget_vincentdjango/forum/migrations/0002_reply_post.py
0 → 100644
View file @
68d03b5a
# Generated by Django 3.2 on 2023-03-05 08:57
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'forum'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'reply'
,
name
=
'post'
,
field
=
models
.
ForeignKey
(
default
=
True
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'forum.forumpost'
),
),
]
widget_vincentdjango/forum/migrations/__init__.py
0 → 100644
View file @
68d03b5a
widget_vincentdjango/forum/models.py
0 → 100644
View file @
68d03b5a
# forum/models.py
from
django.db
import
models
from
dashboard.models
import
WidgetUser
class
ForumPost
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
100
)
body
=
models
.
CharField
(
max_length
=
200
)
author
=
models
.
ForeignKey
(
WidgetUser
,
null
=
True
,
default
=
True
,
on_delete
=
models
.
CASCADE
,
)
pub_datetime
=
models
.
DateTimeField
()
def
__str__
(
self
):
return
self
.
title
def
format_pub_datetime
(
self
):
return
self
.
pub_datetime
.
strftime
(
'
%
m/
%
d/
%
Y
%
I:
%
M
%
p'
)
class
Reply
(
models
.
Model
):
post
=
models
.
ForeignKey
(
ForumPost
,
null
=
True
,
default
=
True
,
on_delete
=
models
.
CASCADE
,
)
body
=
models
.
CharField
(
max_length
=
200
)
author
=
models
.
ForeignKey
(
WidgetUser
,
null
=
True
,
default
=
True
,
on_delete
=
models
.
CASCADE
,
)
pub_datetime
=
models
.
DateTimeField
()
def
__str__
(
self
):
return
self
.
body
def
format_pub_datetime
(
self
):
return
self
.
pub_datetime
.
strftime
(
'
%
m/
%
d/
%
Y
%
I:
%
M
%
p'
)
widget_vincentdjango/forum/tests.py
0 → 100644
View file @
68d03b5a
from
django.test
import
TestCase
# Create your tests here.
widget_vincentdjango/forum/urls.py
0 → 100644
View file @
68d03b5a
# forum/urls.py
from
django.urls
import
path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
]
# This might be needed, depending on your Django version
app_name
=
"forum"
widget_vincentdjango/forum/views.py
0 → 100644
View file @
68d03b5a
# appname/views.py
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
ForumPost
,
Reply
from
dashboard.models
import
WidgetUser
def
index
(
request
):
head
=
"<h1 style='border-bottom:4px solid lightgray;
\
padding-bottom:30px;
\
font-size:450
%
;'>
\
Widget Forum
\
</h1>"
body
=
"<h2>Forum Posts:</h2>"
for
post
in
ForumPost
.
objects
.
all
():
body
+=
"<div style='border: 2px solid gray; border-radius:5px; padding:20px 30px;'>
\
<b>{}</b> by {} {} posted {}:
\
<br>
\
{}"
.
format
(
post
.
title
,
post
.
author
.
first_name
,
post
.
author
.
last_name
,
post
.
format_pub_datetime
(),
post
.
body
)
for
reply
in
Reply
.
objects
.
all
():
if
reply
.
post
==
post
:
body
+=
"<p style='border: 1px dashed gray; border-radius:5px; padding:20px 30px;'>
\
Reply by {} {} posted {}:
\
<br>
\
{}"
.
format
(
reply
.
author
.
first_name
,
reply
.
author
.
last_name
,
reply
.
format_pub_datetime
(),
reply
.
body
)
body
+=
"</div>"
body
+=
"<p> </p>"
return_string
=
"<html>
\
<body style = 'font-family:helvetica;
\
padding:30px;'>
\
{}{}
\
</body></html>"
.
format
(
head
,
body
)
return
HttpResponse
(
return_string
)
widget_vincentdjango/widget_vincentdjango/settings.py
View file @
68d03b5a
...
@@ -43,6 +43,7 @@ INSTALLED_APPS = [
...
@@ -43,6 +43,7 @@ INSTALLED_APPS = [
'dashboard'
,
'dashboard'
,
'assignments'
,
'assignments'
,
'announcementBoard'
,
'announcementBoard'
,
'forum'
,
]
]
MIDDLEWARE
=
[
MIDDLEWARE
=
[
...
...
widget_vincentdjango/widget_vincentdjango/urls.py
View file @
68d03b5a
...
@@ -21,4 +21,5 @@ urlpatterns = [
...
@@ -21,4 +21,5 @@ urlpatterns = [
path
(
'dashboard/'
,
include
(
'dashboard.urls'
,
namespace
=
"dashboard"
)),
path
(
'dashboard/'
,
include
(
'dashboard.urls'
,
namespace
=
"dashboard"
)),
path
(
'assignments/'
,
include
(
'assignments.urls'
,
namespace
=
"assignments"
)),
path
(
'assignments/'
,
include
(
'assignments.urls'
,
namespace
=
"assignments"
)),
path
(
'announcementBoard/'
,
include
(
'announcementBoard.urls'
,
namespace
=
"announcementBoard"
)),
path
(
'announcementBoard/'
,
include
(
'announcementBoard.urls'
,
namespace
=
"announcementBoard"
)),
path
(
'forum/'
,
include
(
'forum.urls'
,
namespace
=
"forum"
)),
]
]
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