Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widgets_FEKK
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
Kyla Martin
widgets_FEKK
Commits
3ac628a2
Commit
3ac628a2
authored
May 24, 2022
by
Franco Velasco
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tan/assignments' into 'master'
Added POST functionality to Assignments See merge request
!20
parents
4f7f5afc
26c273cc
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
100 additions
and
3 deletions
+100
-3
forms.py
WidgetFEKK/Assignments/forms.py
+8
-0
0008_assignment_image.py
WidgetFEKK/Assignments/migrations/0008_assignment_image.py
+18
-0
models.py
WidgetFEKK/Assignments/models.py
+1
-0
index.css
WidgetFEKK/Assignments/static/css/index.css
+5
-0
assignment_detail.html
.../Assignments/templates/Assignments/assignment_detail.html
+5
-1
assignment_post.html
WidgetFEKK/Assignments/templates/assignment_post.html
+32
-0
assignments.html
WidgetFEKK/Assignments/templates/assignments.html
+4
-0
views.py
WidgetFEKK/Assignments/views.py
+25
-1
urls.py
WidgetFEKK/WidgetFEKK/urls.py
+2
-1
No files found.
WidgetFEKK/Assignments/forms.py
0 → 100644
View file @
3ac628a2
from
django
import
forms
from
.models
import
Assignment
class
AssignmentForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Assignment
fields
=
'__all__'
WidgetFEKK/Assignments/migrations/0008_assignment_image.py
0 → 100644
View file @
3ac628a2
# Generated by Django 4.0.4 on 2022-05-24 10:11
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'Assignments'
,
'0007_alter_assignment_course'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'assignment'
,
name
=
'image'
,
field
=
models
.
ImageField
(
blank
=
True
,
null
=
True
,
upload_to
=
''
),
),
]
WidgetFEKK/Assignments/models.py
View file @
3ac628a2
...
@@ -18,6 +18,7 @@ class Assignment(models.Model):
...
@@ -18,6 +18,7 @@ class Assignment(models.Model):
on_delete
=
models
.
CASCADE
,
on_delete
=
models
.
CASCADE
,
related_name
=
'requirements'
related_name
=
'requirements'
)
)
image
=
models
.
ImageField
(
null
=
True
,
blank
=
True
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'Assignment name: {} :{}'
.
format
(
self
.
name
,
self
.
description
)
return
'Assignment name: {} :{}'
.
format
(
self
.
name
,
self
.
description
)
...
...
WidgetFEKK/Assignments/static/css/index.css
View file @
3ac628a2
...
@@ -76,4 +76,9 @@ a:hover{
...
@@ -76,4 +76,9 @@ a:hover{
#details
h4
{
#details
h4
{
font-size
:
20px
;
font-size
:
20px
;
font-weight
:
500
;
font-weight
:
500
;
}
#button
a
{
font-weight
:
900px
;
padding
:
5em
;
}
}
\ No newline at end of file
WidgetFEKK/Assignments/templates/Assignments/assignment_detail.html
View file @
3ac628a2
...
@@ -10,7 +10,11 @@
...
@@ -10,7 +10,11 @@
</div>
</div>
<div
id =
"details"
>
<div
id =
"details"
>
<img
src=
"{%static 'images/jokebear.png'%}"
>
<a
href =
"/assignments"
>
> Back to home
</a>
<br>
<!-- <img src="{%static 'images/jokebear.png'%}">-->
<img
src =
"{{object.image.url}}"
>
<h5>
Assignment Name:
</h5>
<h5>
Assignment Name:
</h5>
<h3>
{{object.name}}
</h3>
<h3>
{{object.name}}
</h3>
<h4>
<b>
Assignment Description:
</b>
{{object.description}}
</h4>
<h4>
<b>
Assignment Description:
</b>
{{object.description}}
</h4>
...
...
WidgetFEKK/Assignments/templates/assignment_post.html
0 → 100644
View file @
3ac628a2
{% extends 'base.html' %}
{% load static %}
{% block styles %}
<link
rel =
"stylesheet"
href=
"{% static 'css/index.css' %}"
>
<link
rel=
"preconnect"
href=
"https://fonts.googleapis.com"
>
<link
rel=
"preconnect"
href=
"https://fonts.gstatic.com"
crossorigin
>
<link
href=
"https://fonts.googleapis.com/css2?family=Inter:wght@200;500;900&display=swap"
rel=
"stylesheet"
>
{% endblock styles %}
{% block title %} Assignments {% endblock title%}
{% block content %}
<div
id =
"header"
>
<h1>
Create a new assignment
</h1>
</div>
<div
id =
"courses"
style=
"margin: 5em;"
>
<a
href =
"/assignments"
>
> Back to home
</a>
<form
action=
"{% url 'Assignments:assignment-list' %}"
method =
"POST"
style =
"padding-top: 5em;"
enctype =
"multipart/form-data"
>
{% csrf_token %}
{{form}}
<input
type =
"submit"
value =
"Create New Subject"
>
</form>
</div>
{%endblock content%}
\ No newline at end of file
WidgetFEKK/Assignments/templates/assignments.html
View file @
3ac628a2
...
@@ -17,5 +17,9 @@
...
@@ -17,5 +17,9 @@
<h1>
List of courses:
</h1>
<h1>
List of courses:
</h1>
</div>
</div>
{% include "Assignments/assignment_list.html" with assignments=assignment course=course %}
{% include "Assignments/assignment_list.html" with assignments=assignment course=course %}
<div
id =
"button"
>
<a
href =
"/assignments/add"
id =
"assignment-button"
style =
"font-weight: 900px"
>
> New Assignment
</a>
</div>
{%endblock content%}
{%endblock content%}
\ No newline at end of file
WidgetFEKK/Assignments/views.py
View file @
3ac628a2
from
django.shortcuts
import
render
from
ast
import
Assign
from
django.shortcuts
import
render
,
redirect
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.views
import
View
from
django.views
import
View
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
from
django.views.generic.list
import
ListView
from
.models
import
Assignment
,
Course
from
.models
import
Assignment
,
Course
from
.forms
import
AssignmentForm
class
MainView
(
View
):
class
MainView
(
View
):
def
get
(
self
,
request
):
def
get
(
self
,
request
):
...
@@ -13,10 +15,32 @@ class MainView(View):
...
@@ -13,10 +15,32 @@ class MainView(View):
return
render
(
request
,
'assignments.html'
,{
return
render
(
request
,
'assignments.html'
,{
'course'
:
course
,
'course'
:
course
,
'assignment'
:
assignment
,
'assignment'
:
assignment
,
'form'
:
AssignmentForm
(),
})
})
class
AssignmentListView
(
ListView
):
class
AssignmentListView
(
ListView
):
model
=
Assignment
model
=
Assignment
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
()
.
get_context_data
(
**
kwargs
)
context
[
'form'
]
=
AssignmentForm
()
return
context
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
form
=
AssignmentForm
(
request
.
POST
,
request
.
FILES
)
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
'/assignments'
)
return
self
.
get
(
request
,
*
args
,
**
kwargs
)
class
AssignmentDetailView
(
DetailView
):
class
AssignmentDetailView
(
DetailView
):
model
=
Assignment
model
=
Assignment
class
AssignmentPostView
(
View
):
def
get
(
self
,
request
):
return
render
(
request
,
'assignment_post.html'
,{
'form'
:
AssignmentForm
(),
})
WidgetFEKK/WidgetFEKK/urls.py
View file @
3ac628a2
...
@@ -19,7 +19,7 @@ from django.contrib import admin
...
@@ -19,7 +19,7 @@ from django.contrib import admin
from
django.urls
import
path
,
include
from
django.urls
import
path
,
include
import
Announcements.views
as
Announcements_views
import
Announcements.views
as
Announcements_views
import
Forum.views
as
Forum_views
import
Forum.views
as
Forum_views
from
Assignments.views
import
AssignmentDetailView
from
Assignments.views
import
AssignmentDetailView
,
AssignmentPostView
from
Homepage.views
import
UserPageView
from
Homepage.views
import
UserPageView
urlpatterns
=
[
urlpatterns
=
[
...
@@ -33,6 +33,7 @@ urlpatterns = [
...
@@ -33,6 +33,7 @@ urlpatterns = [
path
(
'announcements/<int:announcement_id>/details'
,
Announcements_views
.
details
,
name
=
'announcement_details'
),
path
(
'announcements/<int:announcement_id>/details'
,
Announcements_views
.
details
,
name
=
'announcement_details'
),
path
(
'assignments/'
,
include
(
'Assignments.urls'
,
namespace
=
"Assignments"
)),
path
(
'assignments/'
,
include
(
'Assignments.urls'
,
namespace
=
"Assignments"
)),
path
(
'assignment/<int:pk>/details'
,
AssignmentDetailView
.
as_view
(),
name
=
'assignment-detail'
),
path
(
'assignment/<int:pk>/details'
,
AssignmentDetailView
.
as_view
(),
name
=
'assignment-detail'
),
path
(
'assignments/add/'
,
AssignmentPostView
.
as_view
(),
name
=
'assignement-post'
),
]
]
...
...
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