Example #1
0
    def get_object_detail(self, request, obj):
        response = super(PlaceView, self).get_object_detail(request, obj)

        if obj.play_set.count() == 0:
            here = fromstr(b64decode(request.META['HTTP_WHERE']))
            play = Play(place=obj, nothing=True, location=here)
            play.save()

        return response
Example #2
0
def add_play(title, force_insert=False):
    title = re.sub('^(A|An|The) (.*)$', r'\2, \1', title)
    if force_insert:
        play = Play(title=title)
        if not dry_run:
            play.save()
        return play
    play = Play.objects.filter(title__iexact=title).order_by('id')
    if play:
        return play[0]
    play = Play(title=title)
    if not dry_run:
        play.save()
    return play
Example #3
0
def add_play(title, force_insert=False):
    title = re.sub('^(A|An|The) (.*)$', r'\2, \1', title)
    if force_insert:
        play = Play(title=title)
        if not dry_run:
            play.save()
        return play
    play = Play.objects.filter(title__iexact=title).order_by('id')
    if play:
        return play[0]
    play = Play(title=title)
    if not dry_run:
        play.save()
    return play
Example #4
0
    venue.save()

    event = {
        'id': d['id'],
        'url': d['event_url'],
        'title': d['event_desc'],
        'desc': d['event_info'],
        'code': d['event_code'],
        'category': d['main_class'],
        'min_price': d['min_seat_price'],
        'start': datetime.fromtimestamp(int(d['start_timestamp'])).date().isoformat(),
        'end': datetime.fromtimestamp(int(d['end_timestamp'])).date().isoformat(),
    }

    title = re.sub('^(A|An|The) (.*)$', r'\2, \1', event['title'])
    try:
        play = Play.objects.get(title__iexact=title, authors=None)
    except:
        play = Play(title=title)
        play.save()

    production = Production(
        play = play,
        source = '<a href="http://projects.festivalslab.com/2010/">festivalslab</a> (<a href="%s"><s>edfringe</s></a>) <!-- %s %s -->' % (event['url'], event['id'], event['code']),
        description = event['desc'],
    )
    production.save()

    pp = ProductionPlace.objects.get_or_create(production=production, place=venue, start_date=event['start'], end_date=event['end'])

Example #5
0
    title = data['Title'].decode('iso-8859-1').replace('&amp;', '&')
    title = re.sub('^(A|An|The) (.*)$', r'\2, \1', title)

    playwrights = re.findall('<td class="UnderviewEntry">\s*(.*?)\s*</td>\s*<td class="UnderviewEntry">Writer</td>', r)
    authors = []
    for p in playwrights:
        first_name, last_name, dob_year = get_name(p)
        person, created = Person.objects.get_or_create(first_name=first_name, last_name=last_name)
        if dob_year:
            person.dob = ApproximateDate(int(dob_year))
            person.save()
        authors.append(person)

    if len(authors)>1:
        play = Play(title=title)
        play.save()
        for author in authors:
            play.authors.add(author)
    elif len(authors)==1:
        person = authors[0]
        try:
            play = Play.objects.get(title=title, authors=person)
        except:
            try:
                play = Play.objects.get(title=title, authors=None)
                play.authors.add(person)
            except:
                play = Play(title=title)
                play.save()
                play.authors.add(person)