def handle(self, *args, **options): from tendenci.apps.memberships.models import MembershipAppField app_id = options['app_id'] po = 92 for i in xrange(6, 31): if not MembershipAppField.objects.filter( membership_app_id=app_id, field_name='ud%s' % i).exists(): app_field = MembershipAppField(membership_app_id=app_id, field_name='ud%s' % i, label='User Defined %s' % i, position=po, display=False) app_field.save() po += 1
def handle(self, *args, **options): from tendenci.apps.memberships.models import MembershipAppField app_id = options['app_id'] po = 92 for i in xrange(6, 31): if not MembershipAppField.objects.filter( membership_app_id=app_id, field_name='ud%s' % i).exists(): app_field = MembershipAppField( membership_app_id=app_id, field_name='ud%s' % i, label='User Defined %s' % i, position=po, display=False) app_field.save() po += 1
def get_object(self, request, object_id, from_field=None): obj = super(MembershipAppField2Admin, self).get_object(request, object_id) # assign default field_type if obj: if not obj.field_type: if not obj.field_name: obj.field_type = 'section_break' else: obj.field_type = MembershipAppField.get_default_field_type(obj.field_name) return obj