Пример #1
0
    def post(self):    
        """ return the bands for a member """
        the_user = self.user

        the_member_key=self.request.get('mk','0')
        
        if the_member_key=='0':
            return # todo figure out what to do
            
        the_member_key=ndb.Key(urlsafe=the_member_key)
        the_member = the_member_key.get()
        
        the_assocs = assoc.get_assocs_of_member_key(the_member_key=the_member.key, confirmed_only=False)

        the_assoc_info=[]
        for an_assoc in the_assocs:
            the_assoc_info.append({
                            'assoc' : an_assoc,
                            'sections' : band.get_section_keys_of_band_key(an_assoc.band)
                            })

        template_args = {
            'the_member' : the_member,
            'the_assoc_info' : the_assoc_info,
            'the_colors' : colors
        }
        self.render_template('member_band_assocs.html', template_args)
Пример #2
0
def forget_member_from_key(the_member_key):
    """ deletes a member, including all gig plans """

    # first find all of the assocs to bands
    the_assocs = assoc.get_assocs_of_member_key(the_member_key=the_member_key,
                                                confirmed_only=False)
    # delete all plans & abdicate as contact for gigs
    for an_assoc in the_assocs:
        plan.delete_plans_for_member_key_for_band_key(the_member_key,
                                                      an_assoc.band)
        gig.reset_gigs_for_contact_key(the_member_key, an_assoc.band)

    # now quit the bands
    the_assoc_keys = [a.key for a in the_assocs]
    ndb.delete_multi(the_assoc_keys)

    # delete the old unique values
    the_member = the_member_key.get()
    if the_member:
        Unique.delete_multi([
            'Member.auth_id:%s' % the_member.email_address,
            'Member.email_address:%s' % the_member.email_address
        ])
    # bye!
    the_member_key.delete()
Пример #3
0
    def get(self, *args, **kwargs):

        the_assocs = assoc.get_assocs_of_member_key(self.user.key,
                                                    confirmed_only=True,
                                                    include_hidden=True,
                                                    keys_only=False)

        info = [
            band.rest_band_info(a.band.get(), the_assoc=a) for a in the_assocs
        ]
        return info
Пример #4
0
    def _make_page(self,the_user):
    
        the_members = get_all_members(verified_only=True)

        member_band_info={}
        for a_member in the_members:
            assocs=assoc.get_assocs_of_member_key(a_member.key, confirmed_only=False)
            member_band_info[a_member.key] = assocs
        
        template_args = {
            'the_members' : the_members,
            'the_band_info' : member_band_info
        }
        self.render_template('member_admin_memberlist.html', template_args)
Пример #5
0
    def _make_page(self,the_user, the_page=0, the_search=None):

        if the_search is None:
            the_members = member.get_all_members(verified_only=True, pagelen=50, page=the_page)
        else:
            the_members = member.search_for_members(verified_only=False, pagelen=50, page=the_page, search=the_search)
        
        member_band_info={}
        for a_member in the_members:
            assocs=assoc.get_assocs_of_member_key(a_member.key, confirmed_only=False)
            member_band_info[a_member.key] = assocs
        
        template_args = {
            'the_members' : the_members,
            'the_band_info' : member_band_info
        }
        self.render_template('member_admin_memberlist.html', template_args)
Пример #6
0
    def _make_page(self,the_user, the_page=0, the_search=None):

        if the_search is None:
            the_members = get_all_members(verified_only=True, pagelen=50, page=the_page)
        else:
            the_members = search_for_members(verified_only=False, pagelen=50, page=the_page, search=the_search)
        
        member_band_info={}
        for a_member in the_members:
            assocs=assoc.get_assocs_of_member_key(a_member.key, confirmed_only=False)
            member_band_info[a_member.key] = assocs
        
        template_args = {
            'the_members' : the_members,
            'the_band_info' : member_band_info
        }
        self.render_template('member_admin_memberlist.html', template_args)
Пример #7
0
    def post(self):    
        """ return the bands for a member """
        the_member_key = member.lookup_member_key(self.request)
        the_assocs = assoc.get_assocs_of_member_key(the_member_key=the_member_key, confirmed_only=False)

        the_assoc_info=[]
        for an_assoc in the_assocs:
            the_assoc_info.append({
                            'assoc' : an_assoc,
                            'sections' : band.get_section_keys_of_band_key(an_assoc.band)
                            })

        template_args = {
            'the_member' : the_member_key.get(),
            'the_assoc_info' : the_assoc_info,
            'the_colors' : colors
        }
        self.render_template('member_band_assocs.html', template_args)
Пример #8
0
    def post(self):    
        """ return the bands for a member """
        the_member_key = lookup_member_key(self.request)
        the_assocs = assoc.get_assocs_of_member_key(the_member_key=the_member_key, confirmed_only=False)

        the_assoc_info=[]
        for an_assoc in the_assocs:
            the_assoc_info.append({
                            'assoc' : an_assoc,
                            'sections' : band.get_section_keys_of_band_key(an_assoc.band)
                            })

        template_args = {
            'the_member' : the_member_key.get(),
            'the_assoc_info' : the_assoc_info,
            'the_colors' : colors
        }
        self.render_template('member_band_assocs.html', template_args)
Пример #9
0
def forget_member_from_key(the_member_key):
    """ deletes a member, including all gig plans """

    # first find all of the assocs to bands
    the_assocs = assoc.get_assocs_of_member_key(the_member_key=the_member_key, confirmed_only=False)
    # delete all plans & abdicate as contact for gigs
    for an_assoc in the_assocs:
        plan.delete_plans_for_member_key_for_band_key(the_member_key, an_assoc.band)
        gig.reset_gigs_for_contact_key(the_member_key, an_assoc.band)

    # now quit the bands
    the_assoc_keys=[a.key for a in the_assocs]
    ndb.delete_multi(the_assoc_keys)

    # delete the old unique values
    the_member=the_member_key.get()
    if the_member:
        Unique.delete_multi(['Member.auth_id:%s'%the_member.email_address,
                             'Member.email_address:%s'%the_member.email_address])  
    # bye!    
    the_member_key.delete()
Пример #10
0
def member_count_bands(the_member_key):
    return len(assoc.get_assocs_of_member_key(the_member_key, confirmed_only=True, keys_only=True))
Пример #11
0
    def get(self, *args, **kwargs):

        the_assocs = assoc.get_assocs_of_member_key(self.user.key, confirmed_only=True, include_hidden=True, keys_only=False)

        info = [band.rest_band_info(a, self.abort) for a in the_assocs]
        return info