Skip to content

Instantly share code, notes, and snippets.

View yattdev's full-sized avatar
🐍
Working from home

Alassane yattdev

🐍
Working from home
View GitHub Profile
@abrookins
abrookins / gist:3440646
Created August 23, 2012 19:32
Set the path of an ImageField in Django
from django.db import models
# Assuming this model.
class Example(models.Model):
image = models.ImageField(upload_to="somewhere/special")
# You want to set this field to point to an existing image (in a script, or a view, etc.).
example = Example.objects.get(id=1)