Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
red_brick_board
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
Ciella Francisco
red_brick_board
Commits
3e5730f3
Commit
3e5730f3
authored
Mar 26, 2024
by
Ciella Francisco
😵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Event model for enabling image upload as headers
parent
003d085d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
models.py
redbrickboard/event_management/models.py
+16
-12
No files found.
redbrickboard/event_management/models.py
View file @
3e5730f3
...
...
@@ -7,25 +7,29 @@ from accounts import models as accounts
class
Event
(
models
.
Model
):
event_name
=
models
.
CharField
(
default
=
''
,
max_length
=
150
)
event_datetime_start
=
models
.
DateTimeField
(
default
=
timezone
.
now
,
null
=
False
)
event_datetime_end
=
models
.
DateTimeField
()
event_datetime_end
=
models
.
DateTimeField
(
default
=
None
,
null
=
True
)
event_organizer
=
models
.
ForeignKey
(
accounts
.
CustomUser
,
on_delete
=
models
.
CASCADE
,
related_name
=
'events_organized'
)
# finalize arguments
event_header
=
models
.
ImageField
(
upload_to
=
'headers/'
,
height_field
=
None
,
width_field
=
None
,
max_length
=
100
,
blank
=
True
)
# research how exactly to do this
event_promos
=
models
.
FileField
(
upload_to
=
'promos/'
,
blank
=
True
,
null
=
True
)
# decide whether to have a separate model for the comments
comments
=
models
.
TextField
()
last_time_bumped
=
models
.
DateTimeField
()
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
event_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'event_management:event
_
details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
return
reverse
(
'event_management:event
-
details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
save
(
self
,
*
args
,
**
kwargs
):
if
self
.
event_datetime_end
is
None
:
self
.
event_datetime_end
=
self
.
event_datetime_start
+
timedelta
(
hours
=
1
)
if
self
.
last_time_bumped
is
None
:
self
.
last_time_bumped
=
self
.
event_datetime_start
super
(
Event
,
self
)
.
save
(
*
args
,
**
kwargs
)
\ No newline at end of file
# def save(self, *args, **kwargs):
# if self.event_datetime_end is None:
# self.event_datetime_end = self.event_datetime_start + timedelta(hours=1)
# if self.last_time_bumped is None:
# self.last_time_bumped = self.event_datetime_start
# super(Event, self).save(*args, **kwargs)
class
Promo
(
models
.
Model
):
img
=
models
.
ImageField
(
upload_to
=
'images/'
,
height_field
=
None
,
width_field
=
None
,
max_length
=
100
,
blank
=
True
)
event_name
=
models
.
ForeignKey
(
Event
,
on_delete
=
models
.
CASCADE
)
class
Comment
(
models
.
Model
):
event_comment
=
models
.
TextField
(
default
=
''
,
max_length
=
255
)
event_name
=
models
.
ForeignKey
(
Event
,
on_delete
=
models
.
CASCADE
)
\ 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