Hello,
*I have 2 models :*

class Product(models.Model):
    product_id = models.AutoField(primary_key=True)
    product_name = models.CharField(max_length=200)
    price = models.IntegerField()
    image =
models.ImageField(upload_to='images/products_images/',null=True,blank=True)


    def __str__(self):
        return self.product_name


class Task(models.Model):
    task_id = models.AutoField(primary_key=True)
    user = models.ForeignKey(User,on_delete = models.CASCADE)
    product = models.ForeignKey(Product,on_delete=models.CASCADE)
    performed_at = models.DateTimeField(auto_now_add=True)

    def __int__(self):
        return self.task_id

*and I have following view with queryset  :*

def product_task (request):
product = Task.objects.select_related().all()
for p in product:
print(p.product.product_name)


*I want to get products don't appear in task model*

-- 
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/CABnE44ztqCOVMkfDXHMVDAA0b3DpiyuSDKbQw7SNR9ybUvVLhA%40mail.gmail.com.

Reply via email to