Federico Maggi avatar Federico Maggi committed 3dbc26f Draft

Now using placeholders

Comments (0)

Files changed (1)


 from academic.utils import *
 from academic.organizations.models import *
+from filebrowser.settings import ADMIN_THUMBNAIL
 class Rank(models.Model):
     The academic rank (e.g., udergraduate student, graduate student,
     picture_url = property(_get_picture_url)
     def photo(self):
-        if self.has_picture:
-            return '<img src="%s" alt="%s">' % (
-                self.picture.url_thumbnail,
-                self.name)
+        if self.picture and self.picture.filetype == "Image":
+            return '<img src="%s" />' % \
+                self.picture.version_generate(ADMIN_THUMBNAIL).url
         return _('(no photo)')
     photo.allow_tags = True
-    def _has_picture(self):
-        return not isinstance(self.picture.filesize, str) \
-            and self.picture.filesize > 0 \
-            and self.picture.filetype_checked == 'Image'
-    has_picture = property(_has_picture)
+    photo.short_description = _('Thumbnail')
     def __unicode__(self):
         return u'%s' % self.name
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.