In [3]:
import os, sys
sys.path.insert(0, '/home/trax/trax/website')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "trax.settings")
import django
django.setup()
from tracks.models import Track, Laptime
from players.models import Player
from events.models import *
from vehicles.models import *
In [13]:
ALREADY_SEEN_UNTIL = 5947
t = Track.objects.get(title__icontains="KIFFLOM")
laps = Laptime.objects.filter(track=t, pk__gte=ALREADY_SEEN_UNTIL).order_by('-pk')
seen_users = []
for l in laps:
if l.player in seen_users:
continue
else:
print (l.player, l.pk, l.created)
seen_users.append(l.player)
In [3]:
l.link
Out[3]:
In [4]:
t = Track.objects.get(title__icontains="KIFFLOM")
u = Player.objects.get(username='cronixx')
hle = Hotlapping.objects.get(pk=32)
print(t.title, u.username, hle.title)
In [ ]:
In [6]:
laps = Laptime.objects.filter(player=u, track=t).order_by('-millis')
for lap in laps:
hllt = lap.hotlappinglaptime_set.all()[0]
print(hllt.pk, hllt.laptime_id, hllt.laptime.link)
In [8]:
Laptime.objects.filter(pk__in=[5824, 5800]).delete()
Out[8]:
In [17]:
hle = Hotlapping.objects.get(pk=32)
In [24]:
hle.title
Out[24]:
In [20]:
l = laps[1]
In [33]:
hllt = HotlappingLaptime.objects.all()[6]
In [35]:
hllt.approved, hllt.laptime, hllt.hotlapping.title
Out[35]:
In [ ]:
In [ ]:
In [37]:
for hll in laps:
x, y = HotlappingLaptime.objects.get_or_create(approved=True, laptime=hll, hotlapping=hle)
print (x, y)
In [6]:
u = Player.objects.get(username__icontains="the_cuunt")
In [4]:
u.username
Out[4]:
In [7]:
u.username = 'esqy'
u.save()
In [ ]: