Exemple #1
0
def tracks_import(*args, **kwargs):
  '''
  Import all new Tracks
  '''
  from users.models import Athlete
  from tracks.providers import all_providers

  for user in Athlete.objects.all():
    providers = [p for p in all_providers(user) if p.is_connected()]
    for provider in providers:
      provider.import_user()
Exemple #2
0
def tracks_import(*args, **kwargs):
    '''
  Import all new Tracks
  '''
    from users.models import Athlete
    from tracks.providers import all_providers

    users = Athlete.objects.all()
    users = users.order_by('pk')
    for user in users:
        if not user.is_premium:
            continue
        for provider in all_providers(user):
            if not provider.is_connected():
                continue

            # Start a subtask per import
            provider_import.subtask((provider, )).apply_async()
Exemple #3
0
def tracks_import(*args, **kwargs):
  '''
  Import all new Tracks
  '''
  from users.models import Athlete
  from tracks.providers import all_providers

  users = Athlete.objects.all()
  users = users.order_by('pk')
  for user in users:
    if not user.is_premium:
      continue
    for provider in all_providers(user):
      if not provider.is_connected():
        continue

      # Start a subtask per import
      provider_import.subtask((provider, )).apply_async()
Exemple #4
0
 def get_context_data(self, *args, **kwargs):
     context = super(TrackProviders, self).get_context_data(*args, **kwargs)
     context['providers'] = all_providers(self.request.user)
     return context
Exemple #5
0
 def get_context_data(self, *args, **kwargs):
   context = super(TrackProviders, self).get_context_data(*args, **kwargs)
   context['providers'] = all_providers(self.request.user)
   return context