Skip to content
Snippets Groups Projects
Commit 4a1bf52e authored by Jan Maximilian Michal's avatar Jan Maximilian Michal
Browse files

Provided basic views for submissions and feedback

parent 53e02009
Branches
No related tags found
No related merge requests found
...@@ -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,
}
...@@ -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'))
] ]
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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment