Skip to content

Commit

Permalink
- added hungaroring option
Browse files Browse the repository at this point in the history
- added session_type dropdown
  • Loading branch information
gotzl committed Dec 12, 2018
1 parent 6de3ed9 commit c8d1bfd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 7 additions & 0 deletions accservermanager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@
('misano', 'Misano'),
('paul_ricard', 'Paul Ricard'),
('nurburgring', 'Nuerburgring GP'),
('hungaroring', 'Hungaroring'),
)

SESSION_TYPES = (
(0,'Practice'),
(4,'Qualify'),
(10,'Race'),
)


Expand Down
7 changes: 5 additions & 2 deletions cfgs/confEdit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import re

from accservermanager.settings import TRACKS
from accservermanager.settings import TRACKS, SESSION_TYPES


def fieldForKey(key, value):
Expand All @@ -14,7 +14,10 @@ def fieldForKey(key, value):
choices=TRACKS,
)
if key == 'sessionType':
return forms.IntegerField(max_value=None, min_value=0)
return forms.ChoiceField(
widget=forms.Select,
choices=SESSION_TYPES,
)

if isinstance(value, list): return forms.CharField()
if isinstance(value, int): return forms.IntegerField()
Expand Down
8 changes: 4 additions & 4 deletions instances/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ def tail(f, n=10):

def log(_f, n):
if _f is not None and os.path.isfile(_f):
with open(_f) as fh:
with open(_f, 'r') as fh:
return HttpResponse(tail(fh, n))
raise Http404


def download(_f):
if _f is not None and os.path.isfile(_f):
with open(_f, 'rb') as fh:
with open(_f, 'r') as fh:
response = HttpResponse(fh.read(), content_type="text/plain")
response['Content-Disposition'] = 'inline; filename=' + os.path.basename(_f)
return response
Expand Down Expand Up @@ -216,12 +216,12 @@ def __init__(self, data):
def random_word():
s = None
while s is None or any(c for c in s if c not in string.ascii_letters):
s = r.get_random_word(hasDictionaryDef="true",minLength=5, maxLength=10)
s = r.get_random_word(hasDictionaryDef="true", minLength=5, maxLength=10)
return s


def index(request):
cfg = json.load(open(os.path.join(settings.ACCSERVER,'cfg','configuration.json'), 'r'))
cfg = json.load(open(os.path.join(settings.ACCSERVER, 'cfg', 'configuration.json'), 'r'))
cfg['instanceName'] = random_word()

template = loader.get_template('instances/instances.html')
Expand Down

0 comments on commit c8d1bfd

Please sign in to comment.