I am working on a django project. where there's two table one is developer table and another one is Jira table. developer table and jira table are connected with m2m relation.
here's my model.py
class developer(models.Model):
Developer_Name = models.CharField(max_length=100, unique=True)
Role = models.CharField(max_length=500)
Level = models.CharField(max_length=30)
Expertise = models.CharField(max_length=200)
Availability_Hours = models.CharField(max_length=500)
def __str__(self):
return self.Developer_Name
class jira(models.Model):
Jira_ID = models.CharField(max_length=100, blank=True)
Jira_Story = models.CharField(max_length=500)
Short_Description = models.CharField(max_length=500)
Story_Points = models.CharField(max_length=30)
Sprint = models.CharField(max_length=200)
DX4C_Object = models.CharField(max_length=500)
Developer = models.ManyToManyField(developer)
Sandbox = models.ForeignKey(environments, on_delete=models.CASCADE, limit_choices_to={'Mainline': None},blank=True, null=True)
def developer_assigned(self):
return ",".join([str(p) for p in self.Developer.all()])
Now my query is how to set a rule where if Dx4c object is changing then automatically one developer will assign based on the rule? here's my view.py
def dependency_management(request):
jira_story = jira.objects.all()
return render(request, 'hello/Dependency_Management.html', {'JIRA': jira_story})
I want to make that dynamic. I mean if everytime I add any new DX4C object then without the code change that particular developer will assign based on the rule