Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_nicsbabes
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
Nics De Vega
midterm_nicsbabes
Commits
ac6aefdc
Commit
ac6aefdc
authored
May 10, 2023
by
Gabriel Geraldo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented edit activity page and function
parent
4cd49e56
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
5 deletions
+26
-5
event-details.html
...get_calendar/templates/widget_calendar/event-details.html
+1
-1
event-edit.html
...widget_calendar/templates/widget_calendar/event-edit.html
+15
-0
urls.py
widget_nicsbabes/widget_calendar/urls.py
+3
-2
views.py
widget_nicsbabes/widget_calendar/views.py
+7
-2
No files found.
widget_nicsbabes/widget_calendar/templates/widget_calendar/event-details.html
View file @
ac6aefdc
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
Venue: {{ object.location.venue }}
Venue: {{ object.location.venue }}
</h2>
</h2>
<form
action=
"
../edit/
"
>
<form
action=
"
edit
"
>
<input
type=
"submit"
value=
"Edit Activity"
>
<input
type=
"submit"
value=
"Edit Activity"
>
</form>
</form>
...
...
widget_nicsbabes/widget_calendar/templates/widget_calendar/event-edit.html
0 → 100644
View file @
ac6aefdc
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Activity{% endblock %}
{% block content %}
<h1>
Edit Activity:
</h1>
<div
class=
"new_user"
>
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<button
type=
"submit"
>
Save New Activity
</button>
</form>
</div>
{% endblock %}
widget_nicsbabes/widget_calendar/urls.py
View file @
ac6aefdc
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
,
EventDetailView
,
EventCreate
Form
View
from
.views
import
index
,
EventDetailView
,
EventCreate
View
,
EventUpdate
View
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
index
,
name
=
'index'
),
path
(
'events/<int:pk>/details'
,
EventDetailView
.
as_view
(),
name
=
'event_details'
),
path
(
'events/<int:pk>/details'
,
EventDetailView
.
as_view
(),
name
=
'event_details'
),
path
(
'events/add'
,
EventCreateFormView
.
as_view
(),
name
=
'event_add'
),
path
(
'events/<int:pk>/edit'
,
EventUpdateView
.
as_view
(),
name
=
'event_edit'
),
path
(
'events/add'
,
EventCreateView
.
as_view
(),
name
=
'event_add'
),
]
]
...
...
widget_nicsbabes/widget_calendar/views.py
View file @
ac6aefdc
...
@@ -2,7 +2,7 @@ from django.shortcuts import render
...
@@ -2,7 +2,7 @@ from django.shortcuts import render
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
Event
,
Location
from
.models
import
Event
,
Location
from
.forms
import
EventCreateForm
from
.forms
import
EventCreateForm
from
django.views.generic.edit
import
CreateView
,
Form
View
from
django.views.generic.edit
import
CreateView
,
Update
View
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
def
index
(
HttpRequest
):
def
index
(
HttpRequest
):
...
@@ -14,7 +14,12 @@ class EventDetailView(DetailView):
...
@@ -14,7 +14,12 @@ class EventDetailView(DetailView):
model
=
Event
model
=
Event
template_name
=
"widget_calendar/event-details.html"
template_name
=
"widget_calendar/event-details.html"
class
EventCreate
Form
View
(
CreateView
):
class
EventCreateView
(
CreateView
):
form_class
=
EventCreateForm
form_class
=
EventCreateForm
# taken from: https://stackoverflow.com/questions/27321692/override-a-django-generic-class-based-view-widget
# taken from: https://stackoverflow.com/questions/27321692/override-a-django-generic-class-based-view-widget
template_name
=
"widget_calendar/event-add.html"
template_name
=
"widget_calendar/event-add.html"
class
EventUpdateView
(
UpdateView
):
model
=
Event
form_class
=
EventCreateForm
template_name
=
"widget_calendar/event-edit.html"
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