restorm icon indicating copy to clipboard operation
restorm copied to clipboard

How to use it with ForeignKey?

Open elcolie opened this issue 9 years ago • 0 comments

Suppose I have a model like this

class FactoryBooking(model.Models):
   factory = models.ForeignKey(Factory, verbose_name=_("factory"), related_name="factory_bookings")
   mechanics = models.ManyToManyField(Mechanic, related_name="factory_bookings", verbose_name=_("mechanics"))

Is it possible to use restorm like

class FactoryBooking(models.Models):
  factory = JSONClient(root_uri='https://myserver.com')
  mechanics = JSONClient(root_uri='https://myserver2.com')

And use like this:

>> Factory.objects.create(factory=instance1, mechanics=instance2)

elcolie avatar Apr 20 '17 07:04 elcolie