Monday, September 25, 2017

CharField vs ImageField for Logo


Hi guys, I am new to django currently stuck in these two.

I am writing my pet project which will display a Team name and their logo. I used these lines for my Team class in mode.spy


class Team(models.Model):
    name = models.CharField(max_length=150)
    logo = models.CharField(null=True, max_length=1000)


    def __str__(self):
        return self.name


Problem is, I can't load the images to my html file My logo images are currently stored in my computer. The images will load properly if I grab an image link online and paste the image location to the Logo field in Admin but if I used the absolute path of the images in my computer, the images wont load. When I tried to inspect the page, I am getting "Image could not load".

Any tips please?


--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA6wQLJ6kjsd80%2BcmFOZhPB5C_1Ugnu%3Ds51aisfNgK%3DambvJUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment