Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
grady
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Maximilian Michal
grady
Commits
4a1bf52e
Commit
4a1bf52e
authored
8 years ago
by
Jan Maximilian Michal
Browse files
Options
Downloads
Patches
Plain Diff
Provided basic views for submissions and feedback
parent
53e02009
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
grady/settings.py
+8
-1
8 additions, 1 deletion
grady/settings.py
grady/urls.py
+2
-1
2 additions, 1 deletion
grady/urls.py
populatedb.py
+54
-0
54 additions, 0 deletions
populatedb.py
with
64 additions
and
2 deletions
grady/settings.py
+
8
−
1
View file @
4a1bf52e
...
@@ -27,7 +27,6 @@ DEBUG = True
...
@@ -27,7 +27,6 @@ DEBUG = True
ALLOWED_HOSTS
=
[]
ALLOWED_HOSTS
=
[]
# Application definition
# Application definition
INSTALLED_APPS
=
[
INSTALLED_APPS
=
[
...
@@ -37,6 +36,7 @@ INSTALLED_APPS = [
...
@@ -37,6 +36,7 @@ INSTALLED_APPS = [
'
django.contrib.sessions
'
,
'
django.contrib.sessions
'
,
'
django.contrib.messages
'
,
'
django.contrib.messages
'
,
'
django.contrib.staticfiles
'
,
'
django.contrib.staticfiles
'
,
'
django_extensions
'
,
'
core
'
,
'
core
'
,
]
]
...
@@ -119,3 +119,10 @@ USE_TZ = True
...
@@ -119,3 +119,10 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.10/howto/static-files/
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL
=
'
/static/
'
STATIC_URL
=
'
/static/
'
FIXTURE_DIRS
=
[
'
/core/fixtures/
'
]
GRAPH_MODELS
=
{
'
all_applications
'
:
True
,
'
group_models
'
:
True
,
}
This diff is collapsed.
Click to expand it.
grady/urls.py
+
2
−
1
View file @
4a1bf52e
...
@@ -13,9 +13,10 @@ Including another URLconf
...
@@ -13,9 +13,10 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r
'
^blog/
'
, include(
'
blog.urls
'
))
2. Add a URL to urlpatterns: url(r
'
^blog/
'
, include(
'
blog.urls
'
))
"""
"""
from
django.conf.urls
import
url
from
django.conf.urls
import
url
,
include
from
django.contrib
import
admin
from
django.contrib
import
admin
urlpatterns
=
[
urlpatterns
=
[
url
(
r
'
^admin/
'
,
admin
.
site
.
urls
),
url
(
r
'
^admin/
'
,
admin
.
site
.
urls
),
url
(
r
'
^
'
,
include
(
'
core.urls
'
))
]
]
This diff is collapsed.
Click to expand it.
populatedb.py
0 → 100644
+
54
−
0
View file @
4a1bf52e
import
os
,
random
os
.
environ
.
setdefault
(
'
DJANGO_SETTINGS_MODULE
'
,
'
grady.settings
'
)
import
django
django
.
setup
()
from
core.models
import
Submission
,
SubmissionType
,
Student
,
Feedback
from
django.contrib.auth.models
import
User
,
Group
def
populate
():
if
User
.
objects
.
get
(
username
=
'
doncamillo
'
):
print
(
"
Was already created. Aborting...
"
)
return
student_group
=
add_group
(
'
Students
'
)
tutor_group
=
add_group
(
'
Tutors
'
)
reviewer_group
=
add_group
(
'
Reviewers
'
)
add_user
(
'
Test_Tutor
'
,
tutor_group
)
add_user
(
'
Test_Reviewer
'
,
reviewer_group
)
add_student
(
'
Test_Student1
'
)
add_student
(
'
Test_Student2
'
)
add_student
(
'
Test_Student3
'
)
def
add_submission_type
(
name
,
score
,
solution
):
SubmissionType
(
name
=
name
,
score
=
score
)
def
add_student
(
name
):
student_group
=
Group
.
objects
.
get
(
name
=
'
Students
'
)
student_user
=
add_user
(
name
,
student_group
)
student
=
Student
(
user
=
student_user
,
matrikel_no
=
20000000
+
random
.
randrange
(
21343
))
student
.
save
()
def
add_user
(
username
,
group
,
password
=
'
password
'
):
user
,
_
=
User
.
objects
.
get_or_create
(
username
=
username
)
user
.
set_password
(
password
)
group
.
user_set
.
add
(
user
)
print
(
"
- Created user {} and added him to group {}
"
.
format
(
user
,
group
))
user
.
save
()
return
user
def
add_group
(
group_name
):
group
,
_
=
Group
.
objects
.
get_or_create
(
name
=
group_name
)
group
.
save
()
return
group
# Start execution here!
if
__name__
==
'
__main__
'
:
print
(
"
Starting population script...
"
)
populate
()
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment