diff --git a/TSDMaster/TSDMaster/templates/login.html b/TSDMaster/TSDMaster/templates/login.html index c245c89..2eae0cb 100644 --- a/TSDMaster/TSDMaster/templates/login.html +++ b/TSDMaster/TSDMaster/templates/login.html @@ -8,7 +8,7 @@
diff --git a/TSDMaster/TSDMaster/admin.py b/TSDMaster/TSDMaster/admin.py index 8c38f3f..17155b8 100644 --- a/TSDMaster/TSDMaster/admin.py +++ b/TSDMaster/TSDMaster/admin.py @@ -1,3 +1,8 @@ from django.contrib import admin +from TSDMaster.models import Contest, Problem, Try # Register your models here. + +admin.site.register(Contest) +admin.site.register(Problem) +admin.site.register(Try) diff --git a/TSDMaster/TSDMaster/forms.py b/TSDMaster/TSDMaster/forms.py index 936c7b7..61566fa 100644 --- a/TSDMaster/TSDMaster/forms.py +++ b/TSDMaster/TSDMaster/forms.py @@ -3,7 +3,7 @@ Definition of forms. """ from datetime import datetime from django import forms -from django.contrib.auth.forms import AuthenticationForm +from django.contrib.auth.forms import AuthenticationForm, UserCreationForm from django.utils.translation import ugettext_lazy as _ class BootstrapAuthenticationForm(AuthenticationForm): @@ -16,3 +16,18 @@ class BootstrapAuthenticationForm(AuthenticationForm): widget=forms.PasswordInput({ 'class': 'form-control', 'placeholder':'Password'})) + + +class BootstrapUserCreationForm(UserCreationForm): + username = forms.CharField(max_length=254, + widget=forms.TextInput({ + 'class': 'form-control', + 'placeholder': 'User name'})) + password1 = forms.CharField(label=_("Password"), + widget=forms.PasswordInput({ + 'class': 'form-control', + 'placeholder':'Password'})) + password2 = forms.CharField(label=_("Password confirm"), + widget=forms.PasswordInput({ + 'class': 'form-control', + 'placeholder':'Password confirm'})) diff --git a/TSDMaster/TSDMaster/models.py b/TSDMaster/TSDMaster/models.py index 71a8362..af09914 100644 --- a/TSDMaster/TSDMaster/models.py +++ b/TSDMaster/TSDMaster/models.py @@ -1,3 +1,34 @@ from django.db import models +from django.contrib.auth.models import User # Create your models here. + + +class Contest(models.Model): + name = models.CharField(max_length=50) + date_start = models.DateTimeField() + date_stop = models.DateTimeField() + problems_file = models.URLField(null=True) + opened = models.BooleanField(default=True) + + +class Problem(models.Model): + problem_id = models.CharField(max_length=1) + name = models.CharField(max_length=100) + tests = models.TextField() + contest = models.ForeignKey(Contest) + + +class Try(models.Model): + problem = models.ForeignKey(Problem) + status = models.CharField(max_length=2) + text = models.TextField(null=True) + reason = models.CharField(max_length=255, null=True) + current_test = models.IntegerField(null=True) + owner = models.ForeignKey(User) + contest = models.ForeignKey(Contest) + + +class UserContest(models.Model): + user = models.OneToOneField(User) + contest = models.ForeignKey(Contest) diff --git a/TSDMaster/TSDMaster/templates/all_contests.html b/TSDMaster/TSDMaster/templates/all_contests.html new file mode 100644 index 0000000..f18a838 --- /dev/null +++ b/TSDMaster/TSDMaster/templates/all_contests.html @@ -0,0 +1,27 @@ +{% extends 'layout.html' %} +{% block content %} +
| # | +Name | +Problems | +Date Start | +Date End | ++ |
|---|---|---|---|---|---|
| {{ contest.id }} | +{{ contest.name }} | +View | +{{ contest.date_start }} | +{{ contest.date_stop }} | +Enter | +
| # | +User | + {% for problem in problems %} +{{ problem.name }} | + {% endfor %} +Summary | +
|---|
{{ problem.problem_id }}: {{ problem.name }}
+ {% endfor %} +{% endblock %} diff --git a/TSDMaster/TSDMaster/templates/layout.html b/TSDMaster/TSDMaster/templates/layout.html index c26874a..27c07ec 100644 --- a/TSDMaster/TSDMaster/templates/layout.html +++ b/TSDMaster/TSDMaster/templates/layout.html @@ -23,15 +23,31 @@