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
f8d01085
Unverified
Commit
f8d01085
authored
Apr 12, 2024
by
Daniella Joan Francisco
Committed by
GitHub
Apr 12, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7 from avraiel/event_management
Event management
parents
3224a0ea
c645e472
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
30 deletions
+31
-30
forms.py
redbrickboard/event_management/forms.py
+19
-8
event-form.html
...ent_management/templates/event_management/event-form.html
+3
-2
views.py
redbrickboard/event_management/views.py
+2
-15
urls.py
redbrickboard/eventcatalog/urls.py
+3
-1
urls.py
redbrickboard/redbrickboard/urls.py
+4
-4
No files found.
redbrickboard/event_management/forms.py
View file @
f8d01085
from
accounts
import
models
as
accounts
from
accounts
import
models
as
accounts
from
django
import
forms
from
django
import
forms
from
django.forms
import
ModelForm
from
.models
import
Event
from
.models
import
Event
# class EventForm(forms.ModelForm):
# class EventForm(forms.ModelForm):
...
@@ -7,11 +8,21 @@ from .models import Event
...
@@ -7,11 +8,21 @@ from .models import Event
# model = Event
# model = Event
# fields = ["event_name", "event_datetime_start", "event_datetime_end", "event_organizer", "event_header", "last_time_bumped"]
# fields = ["event_name", "event_datetime_start", "event_datetime_end", "event_organizer", "event_header", "last_time_bumped"]
class
EventForm
(
forms
.
Form
):
class
EventForm
(
ModelForm
):
event_name
=
forms
.
CharField
(
label
=
'Event Name'
,
max_length
=
150
)
# event_name = forms.CharField(label='Event Name', max_length=150)
event_datetime_start
=
forms
.
DateTimeField
(
label
=
'Event Start Date and Time'
)
# event_datetime_start = forms.DateTimeField(label='Event Start Date and Time')
event_datetime_end
=
forms
.
DateTimeField
(
label
=
'Event End Date and Time'
)
# event_datetime_end = forms.DateTimeField(label='Event End Date and Time')
event_organizer
=
forms
.
ModelChoiceField
(
label
=
'Event Organizer'
,
queryset
=
accounts
.
CustomUser
.
objects
.
all
(),
# event_organizer = forms.ModelChoiceField(label='Event Organizer', queryset=accounts.CustomUser.objects.all())
)
# event_header = forms.ImageField(label='Event Header Photo')
event_header
=
forms
.
ImageField
(
label
=
'Event Header Photo'
)
# last_time_bumped = forms.DateTimeField(label='Last Time Bump')
last_time_bumped
=
forms
.
DateTimeField
(
label
=
'Last Time Bump'
)
class
Meta
:
\ No newline at end of file
model
=
Event
fields
=
"__all__"
# fields = ["event_name", "event_datetime_start", "event_datetime_end",
# "event_organizer", "event_header", "last_time_bumped"]
# fields = ["event_datetime_start"]
widgets
=
{
'event_datetime_start'
:
forms
.
TextInput
(
attrs
=
{
'type'
:
'datetime-local'
}),
'event_datetime_end'
:
forms
.
TextInput
(
attrs
=
{
'type'
:
'datetime-local'
}),
'last_time_bumped'
:
forms
.
TextInput
(
attrs
=
{
'type'
:
'datetime-local'
}),
}
\ No newline at end of file
redbrickboard/event_management/templates/event_management/event-form.html
View file @
f8d01085
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
{% load static %}
{% load static %}
{% block title %}Widget's Forum{% endblock %}
{% block title %}Widget's Forum{% endblock %}
{% block content %}
{% block content %}
{
form.non_field_errors
}
{
{ form.non_field_errors }
}
{% for field in form %}
{% for field in form %}
{% if field.errors %}
{% if field.errors %}
<p>
{{ field.label }} has the following errors:
</p>
<p>
{{ field.label }} has the following errors:
</p>
...
@@ -19,8 +19,9 @@
...
@@ -19,8 +19,9 @@
</ul>
</ul>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
<form
action=
"/add
"
method=
"post"
>
<form
enctype=
"multipart/form-data
"
method=
"post"
>
{% csrf_token %}
{% csrf_token %}
{{ form }}
{{ form }}
<input
type=
"submit"
value=
"Save"
/>
</form>
</form>
{% endblock %}
{% endblock %}
\ No newline at end of file
redbrickboard/event_management/views.py
View file @
f8d01085
...
@@ -19,21 +19,8 @@ class EventListView(ListView):
...
@@ -19,21 +19,8 @@ class EventListView(ListView):
class
EventCreateView
(
CreateView
):
class
EventCreateView
(
CreateView
):
model
=
Event
model
=
Event
fields
=
'__all__'
form_class
=
EventForm
success_url
=
'/events/'
def
get_context_data
(
self
,
**
kwargs
:
Any
)
->
dict
[
str
,
Any
]:
context
=
super
()
.
get_context_data
(
**
kwargs
)
context
[
'form'
]
=
EventForm
()
return
context
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
form
=
EventForm
(
request
.
POST
)
if
form
.
is_valid
():
return
self
.
get
(
request
,
*
args
,
**
kwargs
)
else
:
return
render
(
request
,
self
.
template_name
,
{
'form'
:
form
})
template_name
=
'event_management/event-form.html'
template_name
=
'event_management/event-form.html'
class
EventUpdateView
(
UpdateView
):
class
EventUpdateView
(
UpdateView
):
...
...
redbrickboard/eventcatalog/urls.py
View file @
f8d01085
...
@@ -5,3 +5,5 @@ from . import views
...
@@ -5,3 +5,5 @@ from . import views
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
"index"
),
path
(
''
,
views
.
index
,
name
=
"index"
),
]
]
app_name
=
'event_catalog'
\ No newline at end of file
redbrickboard/redbrickboard/urls.py
View file @
f8d01085
...
@@ -22,10 +22,10 @@ from django.views.generic.base import TemplateView
...
@@ -22,10 +22,10 @@ from django.views.generic.base import TemplateView
urlpatterns
=
[
urlpatterns
=
[
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
"accounts/"
,
include
(
"accounts.urls"
),
name
=
"accounts"
),
path
(
"accounts/"
,
include
(
"accounts.urls"
,
namespace
=
"accounts"
)
),
path
(
"events/"
,
include
(
"event_management.urls"
),
name
=
'eventmanagement'
),
path
(
"events/"
,
include
(
"event_management.urls"
,
namespace
=
'event_management'
)
),
path
(
"eventcatalog/"
,
include
(
"eventcatalog.urls"
),
name
=
"eventcatalog"
),
path
(
"eventcatalog/"
,
include
(
"eventcatalog.urls"
,
namespace
=
"event_catalog"
)
),
path
(
""
,
include
(
"home.urls"
)
,
name
=
"index"
),
path
(
""
,
include
(
"home.urls"
)),
]
]
urlpatterns
+=
static
(
settings
.
MEDIA_URL
,
document_root
=
settings
.
MEDIA_ROOT
)
urlpatterns
+=
static
(
settings
.
MEDIA_URL
,
document_root
=
settings
.
MEDIA_ROOT
)
\ 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