django Pannel error Could not reach the URL. Please check the link - Stack Overflow

Here when i update my model i am getting this error why ?This is my models.pyclass ProductImage(models

Here when i update my model i am getting this error why ?

This is my models.py

class ProductImage(models.Model):
    user = models.ForeignKey(Seller,on_delete=models.CASCADE, related_name='Product_Image_User')
Video = models.FileField(upload_to="Product/video", blank=True, null=True)
images = models.JSONField(default=list)  # Stores multiple image URLs

Date = models.DateTimeField(default=timezone.now)

Product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name="product_images", blank=False, null=False)

secret_key = models.TextField(blank=True,null=True)

def __str__(self):
    return f"{self.user}-{self.Product}-{self.id}"

Here when i update my model i am getting this error why ?

This is my models.py

class ProductImage(models.Model):
    user = models.ForeignKey(Seller,on_delete=models.CASCADE, related_name='Product_Image_User')
Video = models.FileField(upload_to="Product/video", blank=True, null=True)
images = models.JSONField(default=list)  # Stores multiple image URLs

Date = models.DateTimeField(default=timezone.now)

Product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name="product_images", blank=False, null=False)

secret_key = models.TextField(blank=True,null=True)

def __str__(self):
    return f"{self.user}-{self.Product}-{self.id}"
Share Improve this question asked yesterday K KumarK Kumar 713 silver badges10 bronze badges 1
  • So on which item does that occur. This is tagged DRF why? – willeM_ Van Onsem Commented yesterday
Add a comment  | 

1 Answer 1

Reset to default 0

First and Foremost please correctly Indent the code write now django-ORM is not getting which field are in your class ProductImage and write variable in shorter format like ( Video-video).

Even after fixing this if the code do not run there can be error in your views or url or importing of model
Like this:

class ProductImage(models.Model):
    user = models.ForeignKey(Seller,on_delete=models.CASCADE, related_name='Product_Image_User')    
    video = models.FileField(upload_to="Product/video", blank=True, null=True)
    images = models.JSONField(default=list)  # Stores multiple image URLs
    date = models.DateTimeField(default=timezone.now)
    product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name="product_images", blank=False, null=False)
    secret_key = models.TextField(blank=True,null=True)

    def __str__(self):
        return f"{self.user}-{self.Product}-{self.id}"

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743781529a4505890.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信