示例#1
0
 def save_m2m():
     video = self.instance
     if scraped_data.get('user'):
         author, created = User.objects.get_or_create(
             username=scraped_data.get('user'),
             defaults={'first_name': scraped_data.get('user')})
         if created:
             author.set_unusable_password()
             author.save()
             get_profile_model().objects.create(
                 user=author, website=scraped_data.get('user_url'))
         video.authors.add(author)
     old_m2m()
示例#2
0
 def save_m2m():
     video = self.instance
     if scraped_data.get('user'):
         author, created = User.objects.get_or_create(
             username=scraped_data.get('user'),
             defaults={'first_name': scraped_data.get('user')})
         if created:
             author.set_unusable_password()
             author.save()
             get_profile_model().objects.create(
                 user=author,
                 website=scraped_data.get('user_url'))
         video.authors.add(author)
     old_m2m()
示例#3
0
                         HttpResponseRedirect)
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.views.decorators.csrf import csrf_protect

import celery
from importlib import import_module
import simplejson

from localtv.decorators import require_site_admin, referrer_redirect
from localtv import models, tasks, util
from localtv.admin import forms

from vidscraper import bulk_import

Profile = util.get_profile_model()

VIDEO_SERVICE_TITLES = (
    re.compile(r'Uploads by (.+)'),
    re.compile(r"Vimeo / (.+)'s? uploaded videos"),
    re.compile(r'Vimeo / (.+)'),
    re.compile(r"Dailymotion - (.+)'s")
    )

@require_site_admin
@csrf_protect
def add_feed(request):
    add_form = forms.AddFeedForm(request.GET)

    if not add_form.is_valid():
        return HttpResponseBadRequest(
示例#4
0
                         HttpResponseRedirect)
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.views.decorators.csrf import csrf_protect

import celery
from importlib import import_module
import simplejson

from localtv.decorators import require_site_admin, referrer_redirect
from localtv import models, tasks, util
from localtv.admin import forms

from vidscraper import bulk_import

Profile = util.get_profile_model()

VIDEO_SERVICE_TITLES = (re.compile(r'Uploads by (.+)'),
                        re.compile(r"Vimeo / (.+)'s? uploaded videos"),
                        re.compile(r'Vimeo / (.+)'),
                        re.compile(r"Dailymotion - (.+)'s"))


@require_site_admin
@csrf_protect
def add_feed(request):
    add_form = forms.AddFeedForm(request.GET)

    if not add_form.is_valid():
        return HttpResponseBadRequest(add_form['feed_url'].errors.as_text())