python - NameError: name 'ResidentialReference' is not defined [Django - ImageKit] -


for reason error once try apply imagekit onto model create thumbnail imagefield. using imagekit library django can find here

my code below :

from django.db import models pil import image import os django.contrib import admin imagekit.models import imagespecfield imagekit.processors import resizetofill  # create models here. class residentialreference(models.model):     image = models.imagefield(upload_to='images', blank="true",null="true")     thumbnail = imagespecfield(source='image',                                processors=[resizetofill(100,50)],                                format='jpeg',                                options={'quality':60})      title = models.charfield(max_length = 1000, default = 'title here...' )     postcode = models.textfield(max_length = 1000, default='postcode here...')     description = models.textfield(max_length = 12000, default = 'technical description here...')     equipment = models.textfield(max_length = 1000, default = 'equipment here...')     output = models.textfield(max_length = 1000, default = 'rated output here...')     partnership = models.textfield(max_length = 12000, default = 'viessmann partnership details here...')        def __unicode__(self):         return self.title      def create_thumb(self):         residentialreference = residentialreference.objects.all()[0]         print residentialreference.thumbnail.url         print residentialreference.thumbnail.width 

this error doesn't have imagekit.

you're trying reference class inside own definition. code executed when class being defined, @ point residentialreference doesn't exist.

put code method, or take out of class altogether.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -