def formfield_for_dbfield(self, db_field, **kwargs): if db_field.name == 'company': kwargs['queryset'] = getAllCompany(self) if db_field.name == 'estimate_user': kwargs['queryset'] = getAllUsers(self, ESTIMATE_GROUP) if db_field.name == 'users': kwargs['queryset'] = getAllUsers(self, PROJECT_GROUP) field = super(ProjectAdmin, self).formfield_for_dbfield(db_field, **kwargs) return field
def formfield_for_dbfield(self, db_field, **kwargs): if db_field.name == 'company': kwargs['queryset'] = getAllCompany(self) if db_field.name == 'vendor': kwargs['queryset'] = getAllVendor(self) if db_field.name == 'user': kwargs['queryset'] = getAllUsers(self, PURCHASE_GROUP) field = super(InvoiceAdmin, self).formfield_for_dbfield(db_field, **kwargs) return field