i am new in Python,
i want to develop a simple app stock management.
can you give me a brief idea how to add device to stock if it hasnt assigned to employee
i have below models
class Device(models.Model):
STATUS = (
('in use', in use),
('available', 'available')
)
status =models.Charfield(choices=STATUS, max_length=32)
name = models.Charfield(max_length=32)
class Employee(models.Model):
name = models.Charfield(max_length=32)
class Assign(models.Model):
notebook = models.ForeignKey(' Device ', on_delete=models.CASCADE)
subscriber = models.ForeignKey('Employee', on_delete=models.CASCADE)
class Stock(models.Model):
pass
I want if device is already has subscribers then aply its status to 'in_use' and remove it from Stock model and if device status is available then move it to Stock
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1a4ecf34-49e8-4ebf-8a91-78de6b63b5d3n%40googlegroups.com.
No comments:
Post a Comment