Compare commits
No commits in common. "f4144633d6e5c370fa701d68a55a274d9e634cac" and "7ae53b61508ac7e9cb788cdf76b872a3f25d6fd7" have entirely different histories.
f4144633d6
...
7ae53b6150
|
@ -1,7 +0,0 @@
|
|||
from .models import Contest
|
||||
|
||||
|
||||
def current_contest(self):
|
||||
return {
|
||||
'current_contest': Contest.get_current_contest(),
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
# Generated by Django 4.0.1 on 2022-01-22 17:52
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('contest', '0021_alter_qso_otherno_alter_qso_ownno_alter_user_dncall_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='contest',
|
||||
name='contestNo',
|
||||
field=models.IntegerField(default=1, help_text='Running number of contest (for vanity reasons)', validators=[django.core.validators.MinValueValidator(1)]),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -1,19 +0,0 @@
|
|||
# Generated by Django 4.0.1 on 2022-01-22 17:56
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('contest', '0022_contest_contestno'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='contest',
|
||||
name='rulesetLink',
|
||||
field=models.TextField(default='', help_text='URL to the ruleset pdf for this contest'),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -12,9 +12,6 @@ from .validators import CallUsernameValidator
|
|||
class Contest(models.Model):
|
||||
name = models.CharField(max_length=20)
|
||||
shortName = models.CharField(max_length=20, unique=True)
|
||||
contestNo = models.IntegerField(validators=[MinValueValidator(1)],
|
||||
help_text="Running number of contest (for vanity reasons)")
|
||||
rulesetLink = models.TextField(help_text="URL to the ruleset pdf for this contest")
|
||||
callQrg = models.ForeignKey("Frequency", on_delete=models.SET_NULL, null=True, blank=True)
|
||||
deadline = models.DateTimeField()
|
||||
|
||||
|
@ -26,12 +23,7 @@ class Contest(models.Model):
|
|||
|
||||
@classmethod
|
||||
def get_current_contest(cls):
|
||||
# Currently the contest with the latest deadline is the active one
|
||||
# This definitely has potential for improvement, but it's better than a hardcoded contest
|
||||
contests = cls.objects.order_by("-deadline")
|
||||
if len(contests) > 0:
|
||||
return contests[0]
|
||||
return None
|
||||
return cls.objects.get(id=1)
|
||||
|
||||
|
||||
class Reference(models.Model):
|
||||
|
|
|
@ -40,7 +40,6 @@ INSTALLED_APPS = [
|
|||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.humanize',
|
||||
'crispy_forms',
|
||||
'rest_framework',
|
||||
'django_filters',
|
||||
|
@ -73,7 +72,6 @@ TEMPLATES = [
|
|||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'contest.context_processors.current_contest',
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
@ -7,7 +7,7 @@ from contest.views import index, register, profile
|
|||
|
||||
urlpatterns = [
|
||||
path('', index, name="index"),
|
||||
path('contest/', include('contest.urls', namespace='contest')),
|
||||
path('cqtufm2019/', include('contest.urls', namespace='contest')),
|
||||
|
||||
path('admin/', admin.site.urls),
|
||||
path('login/', auth_views.LoginView.as_view(), name='login'),
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<link rel="icon" href="/favicon.ico">
|
||||
{% load static %}
|
||||
|
||||
<title>{{ current_contest.name }}</title>
|
||||
<title>CQTUFM2019 - CQ TU FM Contest 2019</title>
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
|
||||
|
@ -35,7 +35,7 @@
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{% url "index" %}">{{ current_contest.name | default:"NO CONTEST" }}</a>
|
||||
<a class="navbar-brand" href="{% url "index" %}">CQ TU FM 2019</a>
|
||||
</div>
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
|
@ -88,7 +88,7 @@
|
|||
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="text-muted">{{ current_contest.name }} powered by <a href="https://git.dk0tu.de/cqtu/cqtu-webif/">CQTU Contest Webinterface</a> - a <a href="http://dk0tu.de/">DK0TU</a> product</p>
|
||||
<p class="text-muted">CQ TU FM 2019, a <a href="http://dk0tu.de/">DK0TU</a> product</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<p>
|
||||
Welcome to {{ contest.name }}!
|
||||
<p/>
|
||||
<p>Here you can find a short overview over the rules, but note that this is not a replacement for the <a href="{{ current_contest.rulesetLink }}">complete ruleset</a>.</p>
|
||||
<p>Here you can find a short overview over the rules, but note that this is not a replacement for the <a href="http://dk0tu.de/contests/cqtu/CQTU_2017-02-02_FM_Rules+Log.300dpi.pdf">complete ruleset</a>.</p>
|
||||
<p>
|
||||
<ul>
|
||||
<li>Change frequency after a successful CQ-call! If you answered, feel free to call CQ on this frequency.</li>
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% load crispy_forms_tags %}
|
||||
{% load humanize %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{% if current_contest %}
|
||||
<p class="lead">Hello and welcome to the {{ current_contest.contestNo | ordinal }} DK0TU CQ TU contest, the {{ current_contest.name }}!</p>
|
||||
{% else %}
|
||||
<p class="lead">ERROR: No contest set in admin area! If you're an admin <a href="/admin/">go create one</a>.</p>
|
||||
{% endif %}
|
||||
<p class="lead">Hello and welcome to the 4th DK0TU CQ TU contest, the CQ TU 2019!</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue