def __init__(self, warmap=None, initial=None): if warmap is not None: initial = forms.fill_dict(initial, mapname = warmap.name, squad = warmap.squad.id if warmap.squad else None, readmapname = 1 ) else: initial = forms.fill_dict(initial, mapname = _('MapName'), readmapname = 1 ) _WarMapBoundForm.__init__(self, warmap, initial) self.squad.choices = [('','')] + [(squad.id, squad.name) for squad in Squad.query.all()]
def __init__(self, entry=None, initial=None): if entry is not None: initial = forms.fill_dict(initial, text=text, author=author ) _ShoutboxBoundForm.__init__(self, entry, initial)
def __init__(self, war=None, initial=None): if war is not None: initial = forms.fill_dict(initial, orgamember = war.orgamember, status = war.status ) FightUsForm.__init__(self, war, initial) self.contact.required = False self.status.choices = [(k, v) for k, v in warstates.iteritems()] self.orgamember.choices = [(user.id, user.display_name) for user in User.query.namesort().all()] self.newmemberstatus.choices = [(k, v) for k, v in memberstates.iteritems()] if war is not None: self.removemembers.choices = [(member.id, '%s (%s)' % \ (member.display_name, memberstates[war.memberstatus[member]])) for member in war.members] self.newmember.choices = [(-1, u'')] + [(member.id, member.display_name) for member in User.query.namesort().all() if member not in war.members] self.removemaps.choices = [(map.id, map.name) for map in war.maps] self.newmap.choices = [(-1, u'')] + [(map.id, map.name) for map in WarMap.query.all() if map not in war.maps] else: self.newmember.choices = [(-1, u'')] + [(member.id, member.display_name) for member in User.query.namesort().all()] self.newmap.choices = [(-1, u'')] + [(map.id, map.name) for map in WarMap.query.all()] del self.removemembers del self.removemaps
def __init__(self, squad, initial=None): self.relocate_to.choices = [('', u'')] + [ (g.id, g.name) for g in Squad.query.filter(Squad.id != squad.id) ] _SquadBoundForm.__init__(self, squad, forms.fill_dict(initial, action='delete_membership'))
def __init__(self, level=None, initial=None): if level is not None: initial = forms.fill_dict(initial, levelname=level.name, ordering=level.ordering ) _LevelBoundForm.__init__(self, level, initial)
def __init__(self, user, initial=None): if user is not None: initial = forms.fill_dict( initial, username=user.username, real_name=user.real_name, display_name=user._display_name, gender_male=user.gender_male, birthday=user.birthday, height=user.height, address=user.address, zip=user.zip, city=user.city, country=user.country, email=user.email, www=user.www, notes=user.notes, userpictype=user.userpictype, ) _UserBoundForm.__init__(self, user, initial) self.user = user self.display_name.choices = [ (u"$username", user and user.username or _("Username")), (u"$real_name", user and user.real_name or _("Realname")), ] self.gender_male.choices = [(1, _("Male")), (0, _("Female"))] self.country.choices = sorted(get_application().locale.territories.iteritems(), key=itemgetter(1)) self.country.choices.insert(0, ("", "")) self.userpictype.choices = [(u"", _("No change")), (u"None", _("No Picture")), (u"Gravatar", _("Gravatar.com"))]
def __init__(self, level, initial=None): self.relocate_to.choices = [('', u'')] + [ (g.id, g.name) for g in Level.query.filter(Level.id != level.id) ] _LevelBoundForm.__init__(self, level, forms.fill_dict(initial, action='delete_membership'))
def __init__(self, game, initial=None): self.relocate_to.choices = [('', u'')] + [ (g.id, g.name) for g in Game.query.filter(Game.id != game.id) ] _GameBoundForm.__init__(self, game, forms.fill_dict(initial, action='delete_membership'))
def __init__(self, category, initial=None): self.category = category self.relocate_to.choices = [('', u'')] + [ (c.id, c.name) for c in Category.query.filter(Category.id != category.id) ] forms.Form.__init__(self, forms.fill_dict(initial, action='delete'))
def __init__(self, war, warresult=None, initial=None): if warresult is not None: initial = forms.fill_dict(initial, our_points = warresult.our_points, enemy_points = warresult.enemy_points, comment = warresult.comment, status = war.status ) else: initial = forms.fill_dict(initial, status = war.status if war.status > 3 else 4 ) forms.Form.__init__(self, initial) self.app = get_application() self.warresult = warresult self.war = war self.status.choices = [(k, v) for k, v in warstates.iteritems() if k > 3]
def __init__(self, forum, initial=None): self.forum = forum self.relocate_to.choices = [('', u'')] + [ (c.id, c.name) for c in Forum.query.filter(Forum.id != forum.id) ] forms.Form.__init__(self, forms.fill_dict(initial, action='delete'))
def __init__(self, category, initial=None): if category is not None: initial = forms.fill_dict(initial, name=category.name, ordering=category.ordering ) self.category = category forms.Form.__init__(self, initial)
def __init__(self, forum, initial=None): if forum is not None: initial = forms.fill_dict(initial, category=forum.category, name=forum.name, description=forum.description, ordering=forum.ordering, allow_anonymous=forum.allow_anonymous, is_public=forum.is_public ) elif initial is None: initial = forms.fill_dict(initial, allow_anonymous=False, is_public=True ) self.forum = forum self.category.choices = [(c.id, c.name) for c in Category.query.all()] forms.Form.__init__(self, initial)
def __init__(self, user=None, imaccount=None, initial=None): if imaccount: initial = forms.fill_dict( initial, service=imaccount.service, account=imaccount.account, username=user.id or None ) _IMAccountBoundForm.__init__(self, imaccount, initial) self.user = user self.service.choices = [(k, v) for k, v in IMAccount.known_services.iteritems()] self.username.choices = [(user.id, user.display_name) for user in User.query.all()]
def __init__(self, user=None, initial=None): if user is not None: initial = forms.fill_dict( initial, privileges=[x.name for x in user.own_privileges], groups=[g.name for g in user.groups] ) _UserProfileForm.__init__(self, user, initial) self.privileges.choices = self.app.list_privileges() self.groups.choices = [g.name for g in Group.query.all()] self.password.required = user is None
def __init__(self, user, gameaccount=None, initial=None): if gameaccount is not None: initial = forms.fill_dict(initial, game=gameaccount.game, account=gameaccount.account ) _GameAccountBoundForm.__init__(self, gameaccount, initial) self.user = user self.game.choices = [(game.id, game.name) for game in Game.query.all()]
def __init__(self, squad=None, initial=None): if squad is not None: initial = forms.fill_dict(initial, squadname=squad.name, game=squad.game, tag=squad.tag ) _SquadBoundForm.__init__(self, squad, initial) self.game.choices = [(game.id, game.name) for game in Game.query.all()]
def __init__(self, warmode=None, initial=None): if warmode is not None: initial = forms.fill_dict(initial, modename = warmode.name, game = warmode.game.id, free1 = warmode.free1, free2 = warmode.free2, free3 = warmode.free3 ) _WarModeBoundForm.__init__(self, warmode, initial) self.game.choices = [(game.id, game.name) for game in Game.query.all()]
def __init__(self, news=None, initial=None): if news is not None: initial = forms.fill_dict( initial, title=news.title, text=news.text, status=news.status, pub_date=news.pub_date, author=news.author, ) else: initial = forms.fill_dict(initial, status=STATUS_DRAFT) # if we have a request, we can use the current user as a default req = get_request() if req and req.user: initial["author"] = req.user forms.Form.__init__(self, initial) self.news = news self.status.choices = [(STATUS_DRAFT, _("Draft")), (STATUS_PUBLISHED, _("Published"))]
def __init__(self, target, post=None, user=None, initial=None): assert target is not None if post is not None: initial = forms.fill_dict(initial, text = post.text, ) forms.Form.__init__(self, initial) self.user = user or self.request.user self.target = target self.topic = None if isinstance(target, Topic): self.topic = target self.post = post
def __init__(self, war=None, initial=None): if war is not None: initial = forms.fill_dict(initial, clanname = war.clanname, clantag = war.clantag, clanhomepage = war.clanhomepage, date = war.date, server = war.server, squad = war.squad, mode = war.mode, playerchangecount = war.playerchangecount, contact = war.contact, notes = war.notes ) _WarBoundForm.__init__(self, war, initial) self.mode.choices = [(mode.id, mode.name) for mode in WarMode.query.all()] self.squad.choices = [(squad.id, '%s (%s)' % (squad.name, squad.game.name)) for squad in Squad.query.all()]
def __init__(self, squad, squadmember=None, initial=None): if squadmember is not None: initial = forms.fill_dict(initial, clanmember=squadmember.user, level=squadmember.level, othertasks=squadmember.othertasks ) _SquadMemberBoundForm.__init__(self, squadmember, initial) assert squad is not None self.squad = squad # Need access to squad here, as the member might be new and thus there is no # member.squad relation yet. self.clanmember.choices = [(user.id, user.display_name) for \ user in User.query.namesort().all() if user not in self.squad.members] if self.squadmember: self.clanmember.choices.insert(0,(squadmember.user.id, squadmember.user.display_name)) self.level.choices = [(level.id, level.name) for level in Level.query.order_by(Level.ordering).all()]
def __init__(self, group=None, initial=None): if group is not None: initial = forms.fill_dict(initial, groupname=group.name, privileges=[x.name for x in group.privileges]) _GroupBoundForm.__init__(self, group, initial) self.privileges.choices = self.app.list_privileges()
def __init__(self, game=None, initial=None): if game is not None: initial = forms.fill_dict(initial, gamename=game.name ) _GameBoundForm.__init__(self, game, initial)
def __init__(self, group, initial=None): self.relocate_to.choices = [("", u"")] + [(g.id, g.name) for g in Group.query.filter(Group.id != group.id)] _GroupBoundForm.__init__(self, group, forms.fill_dict(initial, action="delete_membership"))
def __init__(self, user, initial=None): _UserBoundForm.__init__(self, user, forms.fill_dict(initial, action="delete"))