Source code for common.forms

__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
__license__ = "AGPL v3"


from django import forms


[docs]class ModelChoiceFieldwithid(forms.ModelChoiceField):
[docs] def label_from_instance(self, obj): return "%s (id = %i)" % (super().label_from_instance(obj), obj.id)