class projectsmodel(models.Model): added_by = models.ForeignKey(settings.AUTH_USER_MODEL,null=True,blank=True,on_delete=models.SET_NULL) projects=models.CharField(max_length=300)
def save_model(self,request,obj,form,change): obj.added_by=request.User super().save_model(request,obj,form,change) def __str__(self): return self.projects My BOQ Model,it is the model that needs to be filtered based on project it is redirected from class boqmodel(models.Model): project_name = models.ForeignKey(projectsmodel, null=True, blank=True, on_delete=models.SET_NULL) code = models.IntegerField() building = models.ForeignKey(building, on_delete=models.SET_NULL, null=True) level = models.ForeignKey(level, on_delete=models.SET_NULL, null=True) activity = models.ForeignKey(activity, on_delete=models.SET_NULL, null=True) subactivity = models.ForeignKey(sub_activity, on_delete=models.SET_NULL, null=True) duration = models.IntegerField() linkactivity = models.CharField(max_length=300, null=True, blank=True) linktype = models.CharField(choices=choicestype, max_length=300, null=True, blank=True) linkduration = models.IntegerField(default=0) plannedstart = models.DateField(null=True, blank=True) plannedfinish = models.DateField(null=True, blank=True) actualstart = models.DateField(null=True, blank=True) actualfinish = models.DateField(null=True, blank=True) -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0ff70f63-df88-430a-ba3c-4b0273395999%40googlegroups.com.