97f90e16bf39f7827fddd5df6b0e79a54f2f759b
[mygpo.git] / mygpo / publisher / management / commands / make-publisher.py
blob97f90e16bf39f7827fddd5df6b0e79a54f2f759b
1 from django.core.management.base import BaseCommand
2 from mygpo.data.historic import calc_podcast
3 from mygpo.api.models import Podcast
4 from django.contrib.auth.models import User
5 from mygpo.publisher.models import PodcastPublisher
7 class Command(BaseCommand):
8 def handle(self, *args, **options):
10 username = args[0]
11 podcast_url = args[1]
13 user = User.objects.get(username=username)
14 podcast = Podcast.objects.get(url=podcast_url)
16 PodcastPublisher.objects.create(user=user, podcast=podcast)