Answer the question
In order to leave comments, you need to log in
Registering label from code in model?
Let's say I have a django project
I'm creating a model
class CodeContext(models.Model):
label = models.CharField('метка в коде', ...)
...
def register_code_label(label, ...):
CodeContext.objects.get_or_create(label=label)
...
@register_code_label('method1', ... )
def method1():
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question