Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_casanatics
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
John Aidan Vincent M. Ng
midterm_casanatics
Commits
feb3c692
Commit
feb3c692
authored
May 01, 2023
by
Angelo Alvarez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Feature: Adding Activities
parent
0f8ec36f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
1 deletion
+21
-1
models.cpython-310.pyc
...asanatics/calendar_app/__pycache__/models.cpython-310.pyc
+0
-0
urls.cpython-310.pyc
..._casanatics/calendar_app/__pycache__/urls.cpython-310.pyc
+0
-0
views.cpython-310.pyc
...casanatics/calendar_app/__pycache__/views.cpython-310.pyc
+0
-0
models.py
widget_casanatics/calendar_app/models.py
+1
-0
event-add.html
...natics/calendar_app/templates/calendar_app/event-add.html
+13
-0
urls.py
widget_casanatics/calendar_app/urls.py
+2
-1
views.py
widget_casanatics/calendar_app/views.py
+5
-0
No files found.
widget_casanatics/calendar_app/__pycache__/models.cpython-310.pyc
View file @
feb3c692
No preview for this file type
widget_casanatics/calendar_app/__pycache__/urls.cpython-310.pyc
View file @
feb3c692
No preview for this file type
widget_casanatics/calendar_app/__pycache__/views.cpython-310.pyc
View file @
feb3c692
No preview for this file type
widget_casanatics/calendar_app/models.py
View file @
feb3c692
...
@@ -33,3 +33,4 @@ class Event(models.Model):
...
@@ -33,3 +33,4 @@ class Event(models.Model):
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'calendar_app:events-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
return
reverse
(
'calendar_app:events-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
widget_casanatics/calendar_app/templates/calendar_app/event-add.html
0 → 100644
View file @
feb3c692
{% extends 'base.html' %}
{% load static %}
{% block title %} Add Activity {% endblock %}
{% block content %}
<form
method=
"POST"
>
{% csrf_token %}
{{ form.as_p }}
<button
type=
"Submit"
>
Save New Activity
</button>
</form>
{% endblock %}
\ No newline at end of file
widget_casanatics/calendar_app/urls.py
View file @
feb3c692
# <appname>/urls.py
# <appname>/urls.py
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
calendar
,
EventDetailView
from
.views
import
calendar
,
EventDetailView
,
EventCreateView
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
calendar
,
name
=
'calendar'
),
path
(
''
,
calendar
,
name
=
'calendar'
),
path
(
'events/<int:pk>/details/'
,
EventDetailView
.
as_view
(),
name
=
'events-details'
),
path
(
'events/<int:pk>/details/'
,
EventDetailView
.
as_view
(),
name
=
'events-details'
),
path
(
'events/add/'
,
EventCreateView
.
as_view
(),
name
=
'add-event'
),
]
]
app_name
=
"calendar_app"
app_name
=
"calendar_app"
\ No newline at end of file
widget_casanatics/calendar_app/views.py
View file @
feb3c692
...
@@ -3,6 +3,7 @@ from django.http import HttpResponse
...
@@ -3,6 +3,7 @@ from django.http import HttpResponse
from
.models
import
Event
from
.models
import
Event
from
django.utils
import
timezone
from
django.utils
import
timezone
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
# Create your views here.
# Create your views here.
...
@@ -16,3 +17,7 @@ class EventDetailView(DetailView):
...
@@ -16,3 +17,7 @@ class EventDetailView(DetailView):
template_name
=
'calendar_app/event-details.html'
template_name
=
'calendar_app/event-details.html'
model
=
Event
model
=
Event
class
EventCreateView
(
CreateView
):
template_name
=
'calendar_app/event-add.html'
model
=
Event
fields
=
[
'activity'
,
'target_datetime'
,
'estimated_hours'
,
'location'
,
'course'
]
\ 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