python - Image Upload Django Admin -


i'm new django , need upload image through admin use on portfolio site making. using sorl-thumbnail have images show on front end, don't know how call them once uploaded or upload them to. here models.py:

from django.db import models  # create models here. class casestudy(models.model):     title = models.charfield(max_length=150)     description = models.textfield()     picture = models.imagefield(upload_to="static")      def __unicode__(self):         return self.title #makes title link in admin 

and here example how use sorl-thumbnail in template:

{% thumbnail item.image "100x700" im %} <img style="margin:{{ im|margin:"100x700" }}" src="{{ im.url }}" width="{{ im.x }}"     height="{{ im.y }}"> {% endthumbnail %} 

any appreciated because django noob.

upload them media, setup media serving (https://docs.djangoproject.com/en/dev/howto/static-files/#serving-files-uploaded-by-a-user-during-development).


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -