...
This commit is contained in:
@@ -79,17 +79,17 @@ class PreferencesFormView(FormView):
|
||||
Returns the initial data to use for forms on this view.
|
||||
"""
|
||||
import pyteamsnap.client
|
||||
import pyteamsnap.objects
|
||||
import pyteamsnap.models
|
||||
|
||||
ts_account = self.request.user.socialaccount_set.first()
|
||||
ts_token = ts_account.socialtoken_set.first()
|
||||
# ts_token =
|
||||
ts = pyteamsnap.client.TeamSnap(token=ts_token)
|
||||
|
||||
me = pyteamsnap.objects.Me(ts)
|
||||
me = pyteamsnap.models.Me(ts)
|
||||
|
||||
teams = [
|
||||
(id, pyteamsnap.objects.Team.get(ts, id=id))
|
||||
(id, pyteamsnap.models.Team.get(ts, id=id))
|
||||
for id in me.data["managed_team_ids"]
|
||||
]
|
||||
|
||||
@@ -117,7 +117,7 @@ def schedule_view(request, team_id=None):
|
||||
client = get_teamsnap_client(request)
|
||||
no_past = bool(request.GET.get("no_past", 0))
|
||||
games_only = bool(request.GET.get("games_only", 0))
|
||||
from pyteamsnap.objects import Event
|
||||
from pyteamsnap.models import Event
|
||||
|
||||
ts_events = Event.search(client, team_id=team_id)
|
||||
if no_past:
|
||||
@@ -144,7 +144,7 @@ def view_event(request, event_id, team_id=None):
|
||||
"teamsnap_event", team_id=request.user.teamsnap_preferences.managed_team_id
|
||||
)
|
||||
|
||||
from pyteamsnap.objects import (
|
||||
from pyteamsnap.models import (
|
||||
AvailabilitySummary,
|
||||
Event,
|
||||
EventLineup,
|
||||
@@ -184,7 +184,8 @@ def view_event(request, event_id, team_id=None):
|
||||
|
||||
def multi_lineup_choose(request, team_id):
|
||||
from django.forms import formset_factory
|
||||
from pyteamsnap.objects import Event
|
||||
|
||||
from pyteamsnap.models import Event
|
||||
|
||||
from .forms import EventChooseForm
|
||||
|
||||
@@ -248,13 +249,13 @@ class OpponentFormView(FormView):
|
||||
def form_valid(self, form):
|
||||
# This method is called when valid form data has been POSTed.
|
||||
# It should return an HttpResponse.
|
||||
import pyteamsnap.objects
|
||||
import pyteamsnap.models
|
||||
|
||||
ts_client = get_teamsnap_client(self.request)
|
||||
user = pyteamsnap.objects.Me(ts_client)
|
||||
user = pyteamsnap.models.Me(ts_client)
|
||||
team_id = int(self.kwargs.get("team_id"))
|
||||
opponent_id = int(self.kwargs.get("opponent_id"))
|
||||
opponent = pyteamsnap.objects.Opponent.get(ts_client, opponent_id)
|
||||
opponent = pyteamsnap.models.Opponent.get(ts_client, opponent_id)
|
||||
if (
|
||||
team_id in user.data["managed_team_ids"]
|
||||
and opponent.data["team_id"] == team_id
|
||||
@@ -282,11 +283,11 @@ class OpponentFormView(FormView):
|
||||
return form
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
import pyteamsnap.objects
|
||||
import pyteamsnap.models
|
||||
|
||||
ts_client = get_teamsnap_client(self.request)
|
||||
context = super().get_context_data(**kwargs)
|
||||
opponent = pyteamsnap.objects.Opponent.get(
|
||||
opponent = pyteamsnap.models.Opponent.get(
|
||||
ts_client, self.kwargs.get("opponent_id")
|
||||
)
|
||||
context["opponent"] = opponent
|
||||
@@ -299,7 +300,7 @@ class Opponents(ListView):
|
||||
pass
|
||||
|
||||
def get_queryset(self):
|
||||
from pyteamsnap.objects import Opponent as TsOpponent
|
||||
from pyteamsnap.models import Opponent as TsOpponent
|
||||
|
||||
ts_client = get_teamsnap_client(self.request)
|
||||
team_id = self.kwargs.get("team_id")
|
||||
|
||||
Reference in New Issue
Block a user