Closed
Description
When two models cross reference each other, Django will defer linking one of the ForeignKeys's related model. This causes django_orm to get a string instead of the model when resolving the model field. A ValueError is currently thrown when this happens. Some how we need to find the hook to fully resolve the model.
Example:
@cinp.model()
class Job( models.Model ):
JOB_TARGET_CHOICES = ( ( 'foundation', 'foundation' ), ( 'structure', 'structure' ) )
JOB_ACTION_CHOICES = ( ( 'build', 'build' ), ( 'destroy', 'destroy' ), ( 'move', 'move' ) )
history_entry = models.OneToOneField( 'History', on_delete=models.CASCADE )
target = models.CharField( max_length=10, choices=JOB_TARGET_CHOICES )
action = models.CharField( max_length=7, choices=JOB_ACTION_CHOICES )
@cinp.model( )
class History( models.Model ):
target = models.CharField( max_length=Job._meta.get_field( 'target' ).max_length, choices=Job.JOB_TARGET_CHOICES )
action = models.CharField( max_length=Job._meta.get_field( 'action' ).max_length, choices=Job.JOB_ACTION_CHOICES )
started = models.DateTimeField()
Metadata
Metadata
Assignees
Labels
No labels