예제 #1
0
def linkedinfo(element, info_input={}):
    info = model_inspect(element.field._get_queryset().model())
    info.update(info_input)

    ngmodel = element.html_name  # field.widget.attrs['ng-model']
    return mark_safe("'{0}','{1}','{2}', '{3}s'".format(
        getattr(settings, 'BASE_URL', ''), ngmodel, info['appname'],
        info['modelname'].lower()))
예제 #2
0
 def get_name(self):
     # If name atrribute exists in Meta
     if 'name' in self.Meta.__dict__:
         # Try to get name from Meta
         name = self.Meta.name
     else:
         # If not try to find it automatically
         info = model_inspect(self.Meta.model())
         if info['verbose_name']:
             name = info['verbose_name']
         else:
             name = info['modelname']
     return name