def type_document(self, doc_type): types = Model.get_types() doc_type = doc_type.upper() for type in types: if type.get('name').upper() == doc_type: return type.get('id') return types[1].get('id')
def get_context_data(self, **kwargs): context = super(ModelControlTemplateView, self).get_context_data(**kwargs) context['doc_types'] = json.dumps(Model.get_types()) context['genders'] = json.dumps(Model.get_genders()) context['menu'] = 'model' context['features'] = json.dumps(Feature.get_data_features()) code = self.request.GET.get('pk') if code is not None: id = Model.objects.get(model_code=code).id context['pk'] = code context['id'] = id return context