コード例 #1
0
 def __init__(self, *args, **kwargs):
     nick = kwargs.pop('nick', None)
     super(ProductionCreditedNickForm, self).__init__(*args, **kwargs)
     if nick:
         self.fields['nick'] = NickField(initial=nick)
     else:
         self.fields['nick'] = NickField()
コード例 #2
0
ファイル: releaser.py プロジェクト: asbjornu/demozoo
class GroupSubgroupForm(forms.Form):
    subgroup_nick = NickField(groups_only=True, label='Subgroup name')
    is_current = forms.BooleanField(required=False,
                                    label='Current subgroup?',
                                    initial=True)

    def log_edit(self, user, member, group):
        # build up log description
        descriptions = []
        changed_fields = self.changed_data
        if 'subgroup_nick' in changed_fields:
            descriptions.append(u"changed subgroup to %s" % member)
        if 'is_current' in changed_fields:
            if self.cleaned_data['is_current']:
                descriptions.append("set as current subgroup")
            else:
                descriptions.append("set as ex-subgroup")
        if descriptions:
            description_list = u", ".join(descriptions)
            Edit.objects.create(
                action_type='edit_subgroup',
                focus=member,
                focus2=group,
                description=u"Updated %s's status as a subgroup of %s: %s" %
                (member, group, description_list),
                user=user)
コード例 #3
0
ファイル: forms.py プロジェクト: vitalkanev/demozoo
class AffiliationForm(forms.Form):
    group_nick = NickField(label='Group', groups_only=True)
    role = forms.ChoiceField(label='Role',
                             choices=[('', '')] + AFFILIATION_TYPES,
                             required=False)

    def log_edit(self, user, affiliation):
        # build up log description
        descriptions = []
        changed_fields = self.changed_data
        if 'group_nick' in changed_fields:
            descriptions.append(u"changed group to %s" % affiliation.group)
        if 'role' in changed_fields:
            descriptions.append("changed role to %s" %
                                (affiliation.get_role_display() or 'None'))
        if descriptions:
            description_list = u", ".join(descriptions)
            Edit.objects.create(
                action_type='edit_bbs_affiliation',
                focus=affiliation.group,
                focus2=affiliation.bbs,
                description=(
                    u"Updated %s's affiliation with %s: %s" %
                    (affiliation.group, affiliation.bbs, description_list)),
                user=user)
コード例 #4
0
ファイル: forms.py プロジェクト: vitalkanev/demozoo
class OperatorForm(forms.Form):
    releaser_nick = NickField(label='Staff member', sceners_only=True)
    role = forms.ChoiceField(label='Role', choices=OPERATOR_TYPES)
    is_current = forms.BooleanField(required=False,
                                    label='Current member?',
                                    initial=True)

    def log_edit(self, user, releaser, bbs):
        # build up log description
        descriptions = []
        changed_fields = self.changed_data
        if 'releaser_nick' in changed_fields:
            descriptions.append(u"changed staff member to %s" % releaser)
        if 'is_current' in changed_fields:
            if self.cleaned_data['is_current']:
                descriptions.append("set as current staff")
            else:
                descriptions.append("set as ex-staff")
        if 'role' in changed_fields:
            descriptions.append("changed role to %s" %
                                self.cleaned_data['role'])
        if descriptions:
            description_list = u", ".join(descriptions)
            Edit.objects.create(
                action_type='edit_bbs_operator',
                focus=releaser,
                focus2=bbs,
                description=u"Updated %s as staff member of %s: %s" %
                (releaser, bbs, description_list),
                user=user)
コード例 #5
0
	def __init__(self, *args, **kwargs):
		nick = kwargs.pop('nick', None)
		production = kwargs.pop('production', None)

		if production:
			# get the list of groups who made the production, and tell the NickField to
			# prioritise members of those groups
			authoring_groups = [
				group_nick.releaser for group_nick in production.author_nicks.filter(releaser__is_group=True)
			]
		else:
			authoring_groups = []

		super(ProductionCreditedNickForm, self).__init__(*args, **kwargs)
		if nick:
			self.fields['nick'] = NickField(initial=nick, prefer_members_of=authoring_groups)
		else:
			self.fields['nick'] = NickField(prefer_members_of=authoring_groups)
コード例 #6
0
ファイル: forms.py プロジェクト: sagamusix/demozoo
class PartyOrganiserForm(forms.Form):
    releaser_nick = NickField(label='Organiser')
    role = forms.CharField(required=False, label='Role', max_length=50)

    def log_edit(self, user, releaser, party):
        # build up log description
        descriptions = []
        changed_fields = self.changed_data
        if 'releaser_nick' in changed_fields:
            descriptions.append(u"changed organiser to %s" % releaser)
        if 'role' in changed_fields:
            descriptions.append("changed role to %s" %
                                (self.cleaned_data['role'] or 'none'))
        if descriptions:
            description_list = u", ".join(descriptions)
            Edit.objects.create(
                action_type='edit_party_organiser',
                focus=releaser,
                focus2=party,
                description=u"Updated %s as organiser of %s: %s" %
                (releaser, party, description_list),
                user=user)
コード例 #7
0
ファイル: test_form_fields.py プロジェクト: asbjornu/demozoo
 class NickForm(forms.Form):
     nick = NickField(required=False)
コード例 #8
0
ファイル: test_form_fields.py プロジェクト: sagamusix/demozoo
 class RequiredNickForm(forms.Form):
     nick = NickField()