Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 3
0
Archivo: tasks.py Proyecto: La0/coach
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()
Ejemplo n.º 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
Ejemplo n.º 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