You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
field=models.ImageField(blank=True, null=True, upload_to=posts.models.image_upload_to), AttributeError: module 'posts.models' has no attribute 'image_upload_to' how it possible this part (field=models.ImageField(blank=True, null=True, upload_to=posts.models.image_upload_to) is in comment any idea?
The text was updated successfully, but these errors were encountered:
while running python manage.py makemigrations i am getting error
models.py
parent = models.ForeignKey("self", blank=True, null=True)
user = models.ForeignKey(settings.AUTH_USER_MODEL)
content = models.CharField(max_length=2000, validators=[validate_content])
post_images = models.ImageField(upload_to='posts/')
liked = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True, related_name='liked')
reply = models.BooleanField(verbose_name='Is a reply?', default=False)
updatd = models.DateTimeField(auto_now=True)
timestamp = models.DateTimeField(auto_now_add=True)
objects = PostManager()
here another image_upload_to part is in same models.py but it is in comment
remember this section( image_upload_to) is in comment
content = instance.post.content
slug = slugify(content)
basename, file_extension = filename.split(".")
new_filename = "%s-%s.%s" %(slug, instance.id, file_extension)
return "posts/%s/%s" %(slug, new_filename)
class PostImages(models.Model):
post = models.ForeignKey(Post)
image = models.FileField(upload_to=image_upload_to, blank=True, null=True)
def str(self):
return self.post.content
error is:
field=models.ImageField(blank=True, null=True, upload_to=posts.models.image_upload_to), AttributeError: module 'posts.models' has no attribute 'image_upload_to'
how it possible this part (field=models.ImageField(blank=True, null=True, upload_to=posts.models.image_upload_to) is in comment any idea?
The text was updated successfully, but these errors were encountered: