Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_vincentdjango
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
Almira Redoble
midterm_vincentdjango
Commits
84f882ed
Commit
84f882ed
authored
May 11, 2023
by
Andrew Justin C. Idquival
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created the per activity details view page
parent
fa6faa1a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
7 deletions
+38
-7
models.py
widget_vincentdjango/widget_calendar/models.py
+1
-2
calendar.html
...o/widget_calendar/templates/widget_calendar/calendar.html
+2
-2
event-details.html
...get_calendar/templates/widget_calendar/event-details.html
+26
-0
urls.py
widget_vincentdjango/widget_calendar/urls.py
+4
-3
views.py
widget_vincentdjango/widget_calendar/views.py
+5
-0
No files found.
widget_vincentdjango/widget_calendar/models.py
View file @
84f882ed
...
@@ -12,7 +12,6 @@ class Location(models.Model):
...
@@ -12,7 +12,6 @@ class Location(models.Model):
return
'{} {}'
.
format
(
self
.
mode
,
self
.
venue
)
return
'{} {}'
.
format
(
self
.
mode
,
self
.
venue
)
class
Event
(
models
.
Model
):
class
Event
(
models
.
Model
):
target_datetime
=
models
.
DateTimeField
(
default
=
datetime
.
now
())
target_datetime
=
models
.
DateTimeField
(
default
=
datetime
.
now
())
activity
=
models
.
CharField
(
max_length
=
100
,
default
=
""
)
activity
=
models
.
CharField
(
max_length
=
100
,
default
=
""
)
...
@@ -31,4 +30,4 @@ class Event(models.Model):
...
@@ -31,4 +30,4 @@ class Event(models.Model):
return
"{} {} {} {}"
.
format
(
self
.
target_datetime
,
self
.
activity
,
self
.
estimated_hours
,
self
.
location
)
return
"{} {} {} {}"
.
format
(
self
.
target_datetime
,
self
.
activity
,
self
.
estimated_hours
,
self
.
location
)
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'calendar:
calender
-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
return
reverse
(
'calendar:
event
-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
widget_vincentdjango/widget_calendar/templates/widget_calendar/calendar.html
View file @
84f882ed
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
<ul>
<ul>
{% for event in events %}
{% for event in events %}
<li>
<li>
<a
href=
"
#
"
>
<a
href=
"
event.get_absolute_url
"
>
{{ event }}
</a>
{{ event
.activity
}}
</a>
</li>
</li>
{% endfor %}
{% endfor %}
</ul>
</ul>
...
...
widget_vincentdjango/widget_calendar/templates/widget_calendar/event-details.html
0 → 100644
View file @
84f882ed
+{% extends 'base.html' %}
{% load static %}
{% block title %} {{ event.activity }} {% endblock %}
{% block heading %}
<p
id=
"uppercase"
>
<span
id=
"white"
>
{{ event.activity}}
</span>
</p>
{% endblock %}
{% block content %}
<div
id=
"main"
>
<p
id=
"subheading"
>
{{ event.target_datetime }}
</p>
<p>
{{ event.estimated_hours }}
</p>
<p>
{{ event.course }}
</p>
<p>
{{ event.estimated_hours }}
</p>
<p>
{{ event.location }}
</p>
</div>
<button
onclick=
"window.location.href='#';"
>
Edit Activity
</button>
{% endblock %}
\ No newline at end of file
widget_vincentdjango/widget_calendar/urls.py
View file @
84f882ed
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
index
,
EventDetailView
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
index
,
name
=
'index'
),
path
(
'calendar/'
,
index
,
name
=
'index'
)
path
(
'calendar/'
,
index
,
name
=
'index'
),
path
(
'events/<int:pk>/details'
,
EventDetailView
.
as_view
(),
name
=
'user-details'
),
]
]
app_name
=
"widget_calendar"
app_name
=
"widget_calendar"
widget_vincentdjango/widget_calendar/views.py
View file @
84f882ed
...
@@ -8,3 +8,8 @@ def index(request):
...
@@ -8,3 +8,8 @@ def index(request):
events
=
Event
.
objects
.
all
()
events
=
Event
.
objects
.
all
()
return
render
(
request
,
'calendar/calendar.html'
,
return
render
(
request
,
'calendar/calendar.html'
,
{
'events'
:
events
,
})
{
'events'
:
events
,
})
class
EventDetailView
(
DetailView
):
model
=
Event
template_name
=
'calendar/event-details.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