Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_robo_mommy
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Raul Jarod Conanan
midterm_robo_mommy
Commits
52d8ac8f
Commit
52d8ac8f
authored
May 13, 2023
by
RJC
Browse files
Options
Browse Files
Download
Plain Diff
directory fix
parents
3482df7e
b58ab87c
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
192 additions
and
0 deletions
+192
-0
midterm_robo_mommy.iml
.idea/midterm_robo_mommy.iml
+15
-0
__init__.py
widget_robo_mommy/assignments/__init__.py
+0
-0
admin.py
widget_robo_mommy/assignments/admin.py
+14
-0
apps.py
widget_robo_mommy/assignments/apps.py
+6
-0
forms.py
widget_robo_mommy/assignments/forms.py
+24
-0
0001_initial.py
widget_robo_mommy/assignments/migrations/0001_initial.py
+34
-0
0002_alter_assignment_course.py
...my/assignments/migrations/0002_alter_assignment_course.py
+19
-0
__init__.py
widget_robo_mommy/assignments/migrations/__init__.py
+0
-0
models.py
widget_robo_mommy/assignments/models.py
+32
-0
tests.py
widget_robo_mommy/assignments/tests.py
+3
-0
urls.py
widget_robo_mommy/assignments/urls.py
+14
-0
views.py
widget_robo_mommy/assignments/views.py
+31
-0
No files found.
.idea/midterm_robo_mommy.iml
0 → 100644
View file @
52d8ac8f
<?xml version="1.0" encoding="UTF-8"?>
<module
version=
"4"
>
<component
name=
"PyDocumentationSettings"
>
<option
name=
"format"
value=
"PLAIN"
/>
<option
name=
"myDocStringFormat"
value=
"Plain"
/>
</component>
<component
name=
"TemplatesService"
>
<option
name=
"TEMPLATE_CONFIGURATION"
value=
"Jinja2"
/>
<option
name=
"TEMPLATE_FOLDERS"
>
<list>
<option
value=
"$MODULE_DIR$/widget_robo_mommy/announcements/templates"
/>
</list>
</option>
</component>
</module>
\ No newline at end of file
widget_robo_mommy/assignments/__init__.py
0 → 100644
View file @
52d8ac8f
widget_robo_mommy/assignments/admin.py
0 → 100644
View file @
52d8ac8f
from
django.contrib
import
admin
from
.models
import
Assignment
,
Course
class
AssignmentAdmin
(
admin
.
ModelAdmin
):
model
=
Assignment
class
CourseAdmin
(
admin
.
ModelAdmin
):
model
=
Course
admin
.
site
.
register
(
Assignment
,
AssignmentAdmin
)
admin
.
site
.
register
(
Course
,
CourseAdmin
)
widget_robo_mommy/assignments/apps.py
0 → 100644
View file @
52d8ac8f
from
django.apps
import
AppConfig
class
AssignmentsConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'assignments'
widget_robo_mommy/assignments/forms.py
0 → 100644
View file @
52d8ac8f
from
django.forms
import
ModelForm
from
.models
import
Assignment
from
django
import
forms
class
AssignmentForm
(
ModelForm
):
class
Meta
:
model
=
Assignment
fields
=
"__all__"
labels
=
{
'name'
:
''
,
'description'
:
''
,
'course'
:
'Course: '
,
'perfect_score'
:
''
,
}
widgets
=
{
'name'
:
forms
.
TextInput
(
attrs
=
{
'class'
:
'form-control'
,
'placeholder'
:
'Assignment Name'
}),
'description'
:
forms
.
Textarea
(
attrs
=
{
'class'
:
'form-control'
,
'placeholder'
:
'Description'
}),
'course'
:
forms
.
Select
(
attrs
=
{
'class'
:
'form-control'
,
'placeholder'
:
'Course'
}),
'perfect_score'
:
forms
.
NumberInput
(
attrs
=
{
'class'
:
'form-control'
,
'placeholder'
:
'Perfect Score'
}),
'passing_score'
:
forms
.
HiddenInput
(),
}
\ No newline at end of file
widget_robo_mommy/assignments/migrations/0001_initial.py
0 → 100644
View file @
52d8ac8f
# Generated by Django 4.1.7 on 2023-03-04 17:11
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Assignment'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'name'
,
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
null
=
True
)),
(
'description'
,
models
.
TextField
(
blank
=
True
,
null
=
True
)),
(
'course'
,
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
null
=
True
)),
(
'perfect_score'
,
models
.
IntegerField
(
blank
=
True
,
null
=
True
)),
(
'passing_score'
,
models
.
IntegerField
(
blank
=
True
,
null
=
True
)),
],
),
migrations
.
CreateModel
(
name
=
'Course'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'code'
,
models
.
CharField
(
blank
=
True
,
max_length
=
10
,
null
=
True
)),
(
'title'
,
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
null
=
True
)),
(
'section'
,
models
.
CharField
(
blank
=
True
,
max_length
=
3
,
null
=
True
)),
],
),
]
widget_robo_mommy/assignments/migrations/0002_alter_assignment_course.py
0 → 100644
View file @
52d8ac8f
# Generated by Django 4.1.7 on 2023-03-04 17:27
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'assignments'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'assignment'
,
name
=
'course'
,
field
=
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'assignments.course'
),
),
]
widget_robo_mommy/assignments/migrations/__init__.py
0 → 100644
View file @
52d8ac8f
widget_robo_mommy/assignments/models.py
0 → 100644
View file @
52d8ac8f
from
django.db
import
models
from
django.urls
import
reverse
class
Course
(
models
.
Model
):
code
=
models
.
CharField
(
max_length
=
10
,
blank
=
True
,
null
=
True
)
title
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
section
=
models
.
CharField
(
max_length
=
3
,
blank
=
True
,
null
=
True
)
def
__str__
(
self
):
return
self
.
code
+
'-'
+
self
.
section
class
Assignment
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
description
=
models
.
TextField
(
blank
=
True
,
null
=
True
)
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
perfect_score
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
)
passing_score
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
)
def
save
(
self
,
*
args
,
**
kwargs
):
self
.
passing_score
=
int
(
self
.
perfect_score
*
0.60
)
super
(
Assignment
,
self
)
.
save
(
*
args
,
**
kwargs
)
def
__str__
(
self
):
return
self
.
name
def
get_absolute_url
(
self
):
return
reverse
(
'assignments:assignments-item'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
get_update_url
(
self
):
return
reverse
(
'assignments:assignments-edit'
,
kwargs
=
{
'pk'
:
self
.
pk
})
widget_robo_mommy/assignments/tests.py
0 → 100644
View file @
52d8ac8f
from
django.test
import
TestCase
# Create your tests here.
widget_robo_mommy/assignments/urls.py
0 → 100644
View file @
52d8ac8f
from
django.urls
import
path
from
.views
import
(
index
,
AssignmentDetailsView
,
AddAssignmentView
,
EditAssignmentView
)
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
'add/'
,
AddAssignmentView
.
as_view
(),
name
=
'assignments-add'
),
path
(
'<int:pk>/edit/'
,
EditAssignmentView
.
as_view
(),
name
=
'assignments-edit'
),
path
(
'<int:pk>/details/'
,
AssignmentDetailsView
.
as_view
(),
name
=
'assignments-item'
),
]
app_name
=
"assignments"
widget_robo_mommy/assignments/views.py
0 → 100644
View file @
52d8ac8f
from
django.shortcuts
import
render
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
Assignment
from
.forms
import
AssignmentForm
class
AssignmentDetailsView
(
DetailView
):
model
=
Assignment
template_name
=
'assignments/assignment-details.html'
class
AddAssignmentView
(
CreateView
):
model
=
Assignment
form_class
=
AssignmentForm
template_name
=
'assignments/assignment-add.html'
class
EditAssignmentView
(
UpdateView
):
model
=
Assignment
form_class
=
AssignmentForm
template_name
=
'assignments/assignment-edit.html'
def
index
(
request
):
assignments
=
Assignment
.
objects
.
all
()
context
=
{
'assignments'
:
assignments
}
return
render
(
request
,
'assignments/assignments.html'
,
context
)
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