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
cda4fa9e
Commit
cda4fa9e
authored
Mar 05, 2023
by
shibadisaster
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added forum models and populated them
parent
0ba74979
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
141 additions
and
2 deletions
+141
-2
0002_auto_20230305_1528.py
...o/announcementBoard/migrations/0002_auto_20230305_1528.py
+35
-0
db.sqlite3
widget_vincentdjango/db.sqlite3
+0
-0
admin.py
widget_vincentdjango/forum/admin.py
+17
-1
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
models.py
widget_vincentdjango/forum/models.py
+35
-1
No files found.
widget_vincentdjango/announcementBoard/migrations/0002_auto_20230305_1528.py
0 → 100644
View file @
cda4fa9e
# 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/db.sqlite3
View file @
cda4fa9e
No preview for this file type
widget_vincentdjango/forum/admin.py
View file @
cda4fa9e
from
django.contrib
import
admin
from
django.contrib
import
admin
from
.models
import
ForumPost
,
Reply
# Register your models here.
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/migrations/0001_initial.py
0 → 100644
View file @
cda4fa9e
# 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 @
cda4fa9e
# 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/models.py
View file @
cda4fa9e
# forum/models.py
from
django.db
import
models
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
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
# Create your models 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