Exemple #1
0
	def __init__(self, data=None, files=None, instance=None, prefix=None):
		self.model = SoundtrackLink
		if instance is None:
			self.instance = Production()
		else:
			self.instance = instance
		qs = self.instance.soundtrack_links.order_by('position')
		super(BaseProductionSoundtrackLinkFormSet, self).__init__(data, files, prefix=prefix, queryset=qs)
Exemple #2
0
	def __init__(self, data=None, files=None, instance=None, prefix=None):
		self.model = PackMember
		if instance is None:
			self.instance = Production()
		else:
			self.instance = instance
		qs = self.instance.pack_members.order_by('position')
		super(BasePackMemberFormSet, self).__init__(data, files, prefix=prefix, queryset=qs)
Exemple #3
0
	def __init__(self, *args, **kwargs):
		self.instance = kwargs.pop('instance', Production())
		super(BaseProductionEditCoreDetailsForm, self).__init__(*args, **kwargs)
		self.fields['title'] = forms.CharField(initial=self.instance.title)
		self.fields['byline'] = BylineField(required=False, initial=self.instance.byline_search(), label='By')
		self.fields['release_date'] = FuzzyDateField(required=False, initial=self.instance.release_date,
			help_text='(As accurately as you know it - e.g. "1996", "Mar 2010")')
		self.fields['platforms'] = forms.ModelMultipleChoiceField(required=False, label='Platform',
			initial=[platform.id for platform in self.instance.platforms.all()],
			queryset=Platform.objects.all())
Exemple #4
0
	def __init__(self, *args, **kwargs):
		self.instance = kwargs.pop('instance', Production())
		super(CreateProductionForm, self).__init__(*args, **kwargs)
		self.fields['title'] = forms.CharField()
		self.fields['byline'] = BylineField(required=False, label='By')
		self.fields['release_date'] = FuzzyDateField(required=False,
			help_text='(As accurately as you know it - e.g. "1996", "Mar 2010")')
		self.fields['types'] = ProductionTypeMultipleChoiceField(required=False, label='Type',
			queryset=ProductionType.featured_types())
		self.fields['platforms'] = forms.ModelMultipleChoiceField(required=False, label='Platform',
			queryset=Platform.objects.all())
Exemple #5
0
def handle_production(prod_data, competition):
	if prod_data.get('id'):
		production = Production.objects.get(id=prod_data['id'])
	else:
		production = Production(
			release_date=competition.shown_date,
			updated_at=datetime.datetime.now(),
			has_bonafide_edits=False)
		production.save()  # assign an ID so that associations work

	# can only edit production details if production is non-stable (which is always true for
	# newly-created ones)
	if not production.is_stable_for_competitions():
		if 'title' in prod_data:
			production.title = prod_data['title']
		if 'platform_id' in prod_data:
			if prod_data['platform_id']:
				production.platforms = [Platform.objects.get(id=prod_data['platform_id'])]
			else:
				production.platforms = []
		if 'production_type_id' in prod_data:
			if prod_data['production_type_id']:
				production.types = [ProductionType.objects.get(id=prod_data['production_type_id'])]
			else:
				production.types = []
		if 'byline' in prod_data:
			try:
				production.author_nicks = [
					NickSelection(author['id'], author['name']).commit()
					for author in prod_data['byline']['authors']
				]
				production.author_affiliation_nicks = [
					NickSelection(affillation['id'], affillation['name']).commit()
					for affillation in prod_data['byline']['affiliations']
				]
				production.unparsed_byline = None
			except NickSelection.FailedToResolve:
				# failed to match up the passed nick IDs to valid nick records.
				# Keep the passed names, as an unparsed byline
				author_names = [author['name'] for author in prod_data['byline']['authors']]
				affiliation_names = [affiliation['name'] for affiliation in prod_data['byline']['affiliations']]
				byline_string = ' + '.join(author_names)
				if affiliation_names:
					byline_string += ' / ' + ' ^ '.join(affiliation_names)
				production.unparsed_byline = byline_string
				production.author_nicks = []
				production.author_affiliation_nicks = []

		production.updated_at = datetime.datetime.now()
		production.supertype = production.inferred_supertype
		production.save()

	return production
Exemple #6
0
 def commit(self):
     if not self.production:
         self.production = Production(
             title=self.title,
             updated_at=datetime.datetime.now(),
         )
         # Ugh. We really ought to come up with a nice way of setting supertype
         # in advance of setting types, rather than having to save a second time
         # once the types are in place...
         self.production.save()
         self.production.types.set(self.types_to_set)
         self.production.save()
         if self.byline:
             self.byline.commit(self.production)
     return self.production
Exemple #7
0
def create(request):
    if request.method == 'POST':
        production = Production(updated_at=datetime.datetime.now())
        form = CreateProductionForm(request.POST, instance=production)
        download_link_formset = ProductionDownloadLinkFormSet(request.POST, instance=production)
        if form.is_valid() and download_link_formset.is_valid():
            form.save()
            download_link_formset.save_ignoring_uniqueness()
            form.log_creation(request.user)
            return HttpResponseRedirect(production.get_absolute_url())
    else:
        form = CreateProductionForm(initial={
            'byline': Byline.from_releaser_id(request.GET.get('releaser_id'))
        })
        download_link_formset = ProductionDownloadLinkFormSet()
    return render(request, 'productions/create.html', {
        'form': form,
        'download_link_formset': download_link_formset,
    })
    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'])

Exemple #9
0
            play = Play(title=title)
            play.save()

    location = re.sub('\.$', '', data.get('Venue', ''))
    location = re.sub('^(A|An|The) (.*)$', r'\2, \1', location)
    location, created = Place.objects.get_or_create(name=location)

    start_date = re.sub('(\d+)/(\d+)/(\d\d\d\d)', r'\3-\1-\2', data.get('OpeningNight', ''))
    press_date = re.sub('(\d+)/(\d+)/(\d\d\d\d)', r'\3-\1-\2', data.get('PressNight', ''))
    press_date = press_date and datetime.strptime(press_date, '%Y-%m-%d') or None
    end_date   = re.sub('(\d+)/(\d+)/(\d\d\d\d)', r'\3-\1-\2', data.get('LastPerformed', ''))
            
    source = '<a href="http://worthing.nationaltheatre.org.uk/Dserve/dserve.exe?dsqIni=Dserve.ini&dsqApp=Archive&dsqCmd=show.tcl&dsqDb=Performance&dsqSearch=PerfCode==%27' + data['PerfCode'] + '%27">RSC Performance Database</a>'

    production = Production(
        play = play,
        source = source,
    )
    production.save()
    ProductionPlace.objects.get_or_create(production=production, place=location, start_date=start_date, press_date=press_date, end_date=end_date)

    m = re.search('<table summary="" class="UnderviewTable">\s*<tr>\s*<td class="UnderviewHeader" colspan=4><p align="center"><font color="#990000" size="4">Creative Roles</font></p></td>\s*</tr>(.*?)</table>(?s)', r)
    if m:
        add_parts(m.group(1), False)
        r = r.replace(m.group(1), '')

    m = re.search('<table summary="" class="UnderviewTable">\s*<tr>\s*<td class="UnderviewHeader" colspan=4><p align="center"><font color="#990000" size="4">Performers</font></p></td>\s*</tr>(.*?)</table>(?s)', r)
    if m:
        add_parts(m.group(1), True)
        r = r.replace(m.group(1), '')

    add_parts(r, None)
Exemple #10
0
def import_text(request, competition_id):
    if not request.user.is_staff:
        return redirect('competition_edit', competition_id)

    competition = get_object_or_404(Competition, id=competition_id)

    if request.POST:
        current_highest_position = CompetitionPlacing.objects.filter(
            competition=competition).aggregate(
                Max('position'))['position__max']
        next_position = (current_highest_position or 0) + 1

        format = request.POST['format']
        if format == 'tsv':
            rows = result_parser.tsv(request.POST['results'])
        elif format == 'pm1':
            rows = result_parser.partymeister_v1(request.POST['results'])
        elif format == 'pm2':
            rows = result_parser.partymeister_v2(request.POST['results'])
        elif format == 'wuhu':
            rows = result_parser.wuhu(request.POST['results'])
        else:
            return redirect('competition_edit', competition_id)

        for placing, title, byline, score in rows:
            if not title:
                continue

            production = Production(release_date=competition.shown_date,
                                    updated_at=datetime.datetime.now(),
                                    has_bonafide_edits=False,
                                    title=title)
            production.save()  # assign an ID so that associations work

            if competition.platform:
                production.platforms = [competition.platform]

            if competition.production_type:
                production.types = [competition.production_type]

            if byline:
                production.byline_string = byline

            production.supertype = production.inferred_supertype
            production.save()

            placing = CompetitionPlacing(
                production=production,
                competition=competition,
                ranking=placing,
                position=next_position,
                score=score,
            )
            next_position += 1
            placing.save()

            Edit.objects.create(
                action_type='add_competition_placing',
                focus=competition,
                focus2=production,
                description=(
                    u"Added competition placing for %s in %s competition" %
                    (production.title, competition)),
                user=request.user)

        return redirect('competition_edit', competition_id)
    else:
        return render(request, 'competitions/import_text.html', {
            'competition': competition,
        })
        else:
            try:
                play = Play.objects.get(title__iexact=title, authors=None)
            except:
                play = Play(title=title)
                play.save()

        company = None
        for c in data['cast']:
            if c[0] == "Playgoers' Society":
                company, created = ProductionCompany.objects.get_or_create(
                    name="Playgoers' Society")

        production = Production(
            play=play,
            company=company,
            source=
            '<a href="http://ahds.ac.uk/ahdscollections/docroot/birminghamrep/birminghamrepdetails.do?id=%s">AHDS Performing Arts</a>'
            % data['id'])
        production.save()

        if 'theatre' in data and data['theatre']:
            location = add_theatre(data['theatre'])
            ProductionPlace.objects.get_or_create(production=production,
                                                  place=location,
                                                  start_date=data['first'],
                                                  end_date=data['last'])
        else:
            location, created = Place.objects.get_or_create(name='Unknown')
            ProductionPlace.objects.get_or_create(production=production,
                                                  place=location,
                                                  start_date=data['first'],
Exemple #12
0
                    play = Play.objects.get(title=title, authors=None)
                    play.authors.add(person)
                except:
                    play = Play(title=title)
                    play.save()
                    play.authors.add(person)
        else:
            try:
                play = Play.objects.get(title=title, authors=None)
            except:
                play = Play(title=title)
                play.save()

        source = '<a href="http://www.bristol.ac.uk/theatrecollection/search/%s">University of Bristol Theatre Collection</a>' % search_link
        production = Production(
            play = play,
            description = notes,
            source = source,
        )
        production.save()

        location = add_theatre(theatre)
        start_date = '%d-00-00' % n
        end_date = '%d-00-00' % (n+1)
        ProductionPlace.objects.get_or_create(production=production, place=location, start_date=start_date, end_date=end_date)

        for forename, surname, cast, role in people:
            person, created = Person.objects.get_or_create(first_name=forename, last_name=surname)
            part = Part.objects.get_or_create(production=production, person=person, role=role, cast=cast)

Exemple #13
0
    log("Production of %s" % title)
    play = add_play(title, force_insert=True)

    company = None
    producer = production['producer']
    if producer:
        if dry_run():
            company = ProductionCompany(name=producer)
        else:
            company, created = ProductionCompany.objects.get_or_create(name=producer)

    description = production['description']
    source = '<a href="%s">its-behind-you.com</a>' % production['source']
    production_obj = Production(
        play = play,
        company = company,
        description = description,
        source = source,
    )
    if not dry_run():
        production_obj.save()

    if production['titleImg']:
        add_photo(production['titleImg'], production_obj, 'Title')

    for p in production['pictures']:
        add_photo(p, production_obj, 'Handbill')

    dates = production['dates']
    for d in dates:
        start_date, end_date = d[0]
        place = d[1]
Exemple #14
0
    end_date = re.sub('\s*(\d\d)/(\d\d)/(\d\d\d\d)\s*', r'\3-\2-\1',
                      data.get('LastPerformed', ''))

    description = data.get('PerformanceNote', '')
    if 'NoPerformances' in data:
        description += ' (%s performance%s)' % (
            data['NoPerformances'], data['NoPerformances'] != 1 and 's' or '')
    description = description.strip()

    source = '<a href="http://calm.shakespeare.org.uk/dserve/dserve.exe?dsqIni=Dserve.ini&dsqApp=Archive&dsqDb=Performance&dsqSearch=PerfCode==%27' + data[
        'PerfCode'] + '%27&dsqCmd=Show.tcl">RSC Performance Database</a>'

    production = Production(
        play=play,
        company=rsc,
        description=description,
        source=source,
    )
    production.save()
    ProductionPlace.objects.get_or_create(production=production,
                                          place=location,
                                          press_date=press_date,
                                          end_date=end_date)

    m = re.search(
        '<table summary="" class="UnderviewTable">\s*<tr>\s*<td class="UnderviewHeader" colspan=4>Creative Roles</td>\s*</tr>(.*?)</table>(?s)',
        r)
    if m:
        add_parts(m.group(1), False)
        r = r.replace(m.group(1), '')