Beispiel #1
0
    def create_member_car(self, car, range_name, model_name, note):
        members = Member.all().filter('number', car.memberno).fetch(10)
        if len(members) == 0:
            print 'WARNING: Could not look up member with no.', car.memberno
            return

        member_car = Car()
        member_car.member = members[0]
        member_car.model = self.get_model(model_name)
        member_car.registration = car.registration
        member_car.year = int(car.year)
        member_car.notes = note
        member_car.serial_no = ''
        member_car.put()
Beispiel #2
0
    def create_member_car(self, car, range_name, model_name, note):
        members = Member.all().filter('number',car.memberno).fetch(10)
        if len(members) == 0:
            print 'WARNING: Could not look up member with no.',car.memberno
            return

        member_car = Car()
        member_car.member = members[0]
        member_car.model = self.get_model(model_name)
        member_car.registration = car.registration
        member_car.year = int(car.year)
        member_car.notes = note
        member_car.serial_no = ''
        member_car.put()
Beispiel #3
0
def task_member_restore(items):

    for item in items:
        member = Member()
        member.number = item['number']
        member.address = item['address']
        if item['email'] != '' and item['email'] != None:
            member.email = db.Email(item['email'])
        member.name = item['name']
        member.member_since = string_to_date(item['memberSince'])
        if item['phone'] != '' and item['phone'] != None:
            member.phone = db.PhoneNumber(item['phone'])
        if item['phoneWork'] != '' and item['phoneWork'] != None:
            member.phone_work = item['phoneWork']
        if item['phoneHome'] != '' and item['phoneHome'] != None:
            member.phone_home = item['phoneHome']
        member.notes = item['notes']
        member.zipcode = item['zipcode']
        member.city = item['city']
        member.county = item['county']
        member.country = db.get(db.Key.from_path('Country', item['countryId']))
        member.status = db.get(db.Key.from_path('Status', item['statusId']))
        member.membertype = db.get(
            db.Key.from_path('MemberType', item['typeId']))
        member.put()

        for itemdue in item['membershipDues']:
            due = MembershipDues(parent=member,
                                 year=itemdue['year'],
                                 paid=itemdue['paid'])
            due.put()

        for itemcar in item['cars']:
            car = Car()
            car.member = member
            car.registration = itemcar['registration']
            car.model = db.get(db.Key.from_path('CarModel',
                                                itemcar['modelId']))
            car.bought_year = itemcar['boughtYear']
            car.sold_year = itemcar['soldYear']
            car.year = itemcar['year']
            car.notes = itemcar['notes']
            car.serial_no = itemcar['serialNo']
            car.put()
Beispiel #4
0
def task_member_restore(items):

    for item in items:
        member = Member()
        member.number = item['number']
        member.address = item['address']
        if item['email'] != '' and item['email'] != None:
            member.email = db.Email(item['email'])
        member.name = item['name']
        member.member_since = string_to_date(item['memberSince'])
        if item['phone'] != '' and item['phone'] != None:
            member.phone = db.PhoneNumber(item['phone'])
        if item['phoneWork'] != '' and item['phoneWork'] != None:
            member.phone_work = item['phoneWork']
        if item['phoneHome'] != '' and item['phoneHome'] != None:
            member.phone_home = item['phoneHome']
        member.notes = item['notes']
        member.zipcode = item['zipcode']
        member.city = item['city']
        member.county = item['county']
        member.country = db.get(db.Key.from_path('Country', item['countryId']))
        member.status = db.get(db.Key.from_path('Status', item['statusId']))
        member.membertype = db.get(db.Key.from_path('MemberType', item['typeId']))
        member.put()

        for itemdue in item['membershipDues']:
            due = MembershipDues(parent=member, year=itemdue['year'],paid=itemdue['paid'])
            due.put()

        for itemcar in item['cars']:
            car = Car()
            car.member = member
            car.registration = itemcar['registration']
            car.model = db.get(db.Key.from_path('CarModel', itemcar['modelId']))
            car.bought_year = itemcar['boughtYear']
            car.sold_year = itemcar['soldYear']
            car.year = itemcar['year']
            car.notes = itemcar['notes']
            car.serial_no = itemcar['serialNo']
            car.put()
Beispiel #5
0
    def post(self, member_id):

        if self.request.get('cancel') == '1':
            return self.redirect('/members')

        if self.request.get('operation') == 'delete_car':
            car = Car.get(self.request.get('car_key'))
            if car:
                car.delete()
            return self.redirect('/members/' + member_id + '/edit')

        member = Member.get(member_id)

        if self.request.get('operation') == 'new_car':
            car = Car()
            car.member = member
            car.model = dbutils.get_default_model()
            car.registration = ''
            car.year = 0
            car.notes = ''
            car.serial_no = ''
            car.put()
            return self.redirect('/members/' + member_id + '/car/' + str(car.key()) + '/edit' )

        member.name = self.request.get('name')
        member.address = self.request.get('address')
        member.zipcode = self.request.get('zip')
        member.city = self.request.get('city')
        member.country = Country.get(self.request.get('country'))
        phone = self.request.get('mobile').strip()
        if phone != '':
            member.phone = db.PhoneNumber(phone)
        else:
            member.phone = None
        email = self.request.get('email').strip()
        if email != '':
            member.email = db.Email(email)
        else:
            member.email = None
        home = self.request.get('fixed').strip()
        if home != '':
            member.phone_home = db.PhoneNumber(home)
        else:
            member.phone_home = None
        work = self.request.get('work').strip()
        if work != '':
            member.phone_work = db.PhoneNumber(work)
        else:
            member.phone_work = None
        member.membertype = MemberType.get(self.request.get('type'))
        member.status = Status.get(self.request.get('status'))
        member.notes = self.request.get('note')

        if self.request.get('access_code') == '':
            member.generate_access_code()

        if self.request.get('magazine_count') != '':
            try:
                member.magazine_count = int(self.request.get('magazine_count'))
            except ValueError:
                pass

        member.put()
        member.update_index()

        # save membership dues
        self.save_dues(member)


        return self.redirect('/members')
Beispiel #6
0
    def post(self, member_id):

        if self.request.get('cancel') == '1':
            return self.redirect('/members')

        if self.request.get('operation') == 'delete_car':
            car = Car.get(self.request.get('car_key'))
            if car:
                car.delete()
            return self.redirect('/members/' + member_id + '/edit')

        member = Member.get(member_id)

        if self.request.get('operation') == 'new_car':
            car = Car()
            car.member = member
            car.model = dbutils.get_default_model()
            car.registration = ''
            car.year = 0
            car.notes = ''
            car.serial_no = ''
            car.put()
            return self.redirect('/members/' + member_id + '/car/' +
                                 str(car.key()) + '/edit')

        member.name = self.request.get('name')
        member.address = self.request.get('address')
        member.zipcode = self.request.get('zip')
        member.city = self.request.get('city')
        member.country = Country.get(self.request.get('country'))
        phone = self.request.get('mobile').strip()
        if phone != '':
            member.phone = db.PhoneNumber(phone)
        else:
            member.phone = None
        email = self.request.get('email').strip()
        if email != '':
            member.email = db.Email(email)
        else:
            member.email = None
        home = self.request.get('fixed').strip()
        if home != '':
            member.phone_home = db.PhoneNumber(home)
        else:
            member.phone_home = None
        work = self.request.get('work').strip()
        if work != '':
            member.phone_work = db.PhoneNumber(work)
        else:
            member.phone_work = None
        member.membertype = MemberType.get(self.request.get('type'))
        member.status = Status.get(self.request.get('status'))
        member.notes = self.request.get('note')

        if self.request.get('access_code') == '':
            member.generate_access_code()

        if self.request.get('magazine_count') != '':
            try:
                member.magazine_count = int(self.request.get('magazine_count'))
            except ValueError:
                pass

        member.put()
        member.update_index()

        # save membership dues
        self.save_dues(member)

        return self.redirect('/members')