Django flatpages and images

I am interested in using the Flatpages application for my project, but would also like a place (somewhere in the admin area) to upload images that I want to link to these flat pages.

Is there a way to do this without resorting to a CMS application?

+4
source share
1 answer

The easiest way is to upload images to a photo hosting service (picasa, flickr, etc.). If you prefer to stick with the django admin, you can write a simple application with one model:

class Image(models.Model): title = models.CharField(max_length=255) file = ImageField(upload_to='car_images') def get_absolute_url(self): return (self.file and self.file.url) or '' 
+1
source

Source: https://habr.com/ru/post/1436652/


All Articles