Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group 23
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
Bianca Aguilar
widget_group 23
Commits
bbe4e819
Commit
bbe4e819
authored
Mar 16, 2022
by
Bianca Aguilar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creating the Post model + Admin for the Forum app
parent
a200ea0d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
59 additions
and
0 deletions
+59
-0
db.sqlite3
db.sqlite3
+0
-0
admin.cpython-310.pyc
forum/__pycache__/admin.cpython-310.pyc
+0
-0
models.cpython-310.pyc
forum/__pycache__/models.cpython-310.pyc
+0
-0
admin.py
forum/admin.py
+6
-0
0001_initial.py
forum/migrations/0001_initial.py
+23
-0
0002_alter_post_post_title_alter_post_pub_date.py
...rations/0002_alter_post_post_title_alter_post_pub_date.py
+23
-0
0001_initial.cpython-310.pyc
forum/migrations/__pycache__/0001_initial.cpython-310.pyc
+0
-0
0002_alter_post_post_title_alter_post_pub_date.cpython-310.pyc
...alter_post_post_title_alter_post_pub_date.cpython-310.pyc
+0
-0
models.py
forum/models.py
+7
-0
No files found.
db.sqlite3
View file @
bbe4e819
No preview for this file type
forum/__pycache__/admin.cpython-310.pyc
View file @
bbe4e819
No preview for this file type
forum/__pycache__/models.cpython-310.pyc
View file @
bbe4e819
No preview for this file type
forum/admin.py
View file @
bbe4e819
from
django.contrib
import
admin
from
django.contrib
import
admin
# Register your models here.
# Register your models here.
from
.models
import
Post
class
PostAdmin
(
admin
.
ModelAdmin
):
model
=
Post
admin
.
site
.
register
(
Post
,
PostAdmin
)
forum/migrations/0001_initial.py
0 → 100644
View file @
bbe4e819
# Generated by Django 4.0.3 on 2022-03-16 04:37
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Post'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'post_title'
,
models
.
CharField
(
max_length
=
100
)),
(
'post_body'
,
models
.
CharField
(
max_length
=
500
)),
(
'pub_date'
,
models
.
DateField
()),
],
),
]
forum/migrations/0002_alter_post_post_title_alter_post_pub_date.py
0 → 100644
View file @
bbe4e819
# Generated by Django 4.0.3 on 2022-03-16 04:49
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'forum'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'post'
,
name
=
'post_title'
,
field
=
models
.
CharField
(
max_length
=
50
),
),
migrations
.
AlterField
(
model_name
=
'post'
,
name
=
'pub_date'
,
field
=
models
.
DateTimeField
(
verbose_name
=
'Date Published'
),
),
]
forum/migrations/__pycache__/0001_initial.cpython-310.pyc
0 → 100644
View file @
bbe4e819
File added
forum/migrations/__pycache__/0002_alter_post_post_title_alter_post_pub_date.cpython-310.pyc
0 → 100644
View file @
bbe4e819
File added
forum/models.py
View file @
bbe4e819
from
django.db
import
models
from
django.db
import
models
# Create your models here.
# Create your models here.
class
Post
(
models
.
Model
):
post_title
=
models
.
CharField
(
max_length
=
50
)
post_body
=
models
.
CharField
(
max_length
=
500
)
pub_date
=
models
.
DateTimeField
(
"Date Published"
)
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
post_title
)
\ No newline at end of file
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