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
98aa801e
Commit
98aa801e
authored
Mar 26, 2024
by
Ciella Francisco
😵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Event Management views and URLs
parent
3e5730f3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
5 deletions
+35
-5
urls.py
redbrickboard/event_management/urls.py
+8
-2
views.py
redbrickboard/event_management/views.py
+27
-3
No files found.
redbrickboard/event_management/urls.py
View file @
98aa801e
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
event_view
,
EventListView
,
EventDetailView
,
EventCreateView
,
EventUpdateView
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
)]
urlpatterns
=
[
path
(
''
,
event_view
,
name
=
'event'
),
path
(
'events/'
,
EventListView
.
as_view
(),
name
=
'event-list'
),
path
(
'<int:pk>/details'
,
EventDetailView
.
as_view
(),
name
=
'event-details'
),
path
(
'add/'
,
EventCreateView
.
as_view
(),
name
=
'event-create'
),
path
(
'<int:pk>/update'
,
EventUpdateView
.
as_view
(),
name
=
'event-update'
),
]
app_name
=
"event_management"
app_name
=
"event_management"
\ No newline at end of file
redbrickboard/event_management/views.py
View file @
98aa801e
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
from
django.views.generic.edit
import
CreateView
,
UpdateView
def
index
(
request
):
from
.models
import
Event
return
HttpResponse
(
'Hello World! This came from the index view.'
)
\ No newline at end of file
def
event_view
(
request
):
events
=
Event
.
objects
.
all
()
context
=
{
'events'
:
events
}
return
render
(
request
,
'event_management/events.html'
,
context
)
class
EventDetailView
(
DetailView
):
model
=
Event
template_name
=
'event_management/event-details.html'
class
EventListView
(
ListView
):
model
=
Event
template_name
=
'event_management/event-list.html'
class
EventCreateView
(
CreateView
):
model
=
Event
fields
=
'__all__'
template_name
=
'event_management/event-create.html'
class
EventUpdateView
(
UpdateView
):
model
=
Event
fields
=
'__all__'
template_name
=
'event/event-update.html'
\ 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