fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More Py3 compatibility fixes.
[wolnelektury.git]
/
src
/
sponsors
/
models.py
diff --git
a/src/sponsors/models.py
b/src/sponsors/models.py
index
0565b97
..
8b50552
100644
(file)
--- a/
src/sponsors/models.py
+++ b/
src/sponsors/models.py
@@
-4,7
+4,7
@@
#
import json
import time
#
import json
import time
-from
StringIO import String
IO
+from
io import Bytes
IO
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.loader import render_to_string
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.loader import render_to_string
@@
-24,7
+24,7
@@
class Sponsor(models.Model):
logo = models.ImageField(_('logo'), upload_to='sponsorzy/sponsor/logo')
url = models.URLField(_('url'), blank=True)
logo = models.ImageField(_('logo'), upload_to='sponsorzy/sponsor/logo')
url = models.URLField(_('url'), blank=True)
- def __
unicode
__(self):
+ def __
str
__(self):
return self.name
def description(self):
return self.name
def description(self):
@@
-75,19
+75,20
@@
class SponsorPage(models.Model):
(THUMB_WIDTH - simg.size[0]) / 2,
i * THUMB_HEIGHT + (THUMB_HEIGHT - simg.size[1]) / 2,
))
(THUMB_WIDTH - simg.size[0]) / 2,
i * THUMB_HEIGHT + (THUMB_HEIGHT - simg.size[1]) / 2,
))
- imgstr =
String
IO()
+ imgstr =
Bytes
IO()
sprite.save(imgstr, 'png')
if self.sprite:
self.sprite.delete(save=False)
sprite.save(imgstr, 'png')
if self.sprite:
self.sprite.delete(save=False)
- self.sprite.save('sponsorzy/sprite/%s-%d.png' % (self.name, time.time()), ContentFile(imgstr.getvalue()), save=False)
+ self.sprite.save('sponsorzy/sprite/%s-%d.png' % (
+ self.name, time.time()), ContentFile(imgstr.getvalue()), save=False)
def html(self):
return self._html
html = property(fget=html)
def save(self, *args, **kwargs):
def html(self):
return self._html
html = property(fget=html)
def save(self, *args, **kwargs):
- if isinstance(self.sponsors,
basestring
):
+ if isinstance(self.sponsors,
str
):
# Walkaround for weird jsonfield 'no-decode' optimization.
self.sponsors = json.loads(self.sponsors)
self.render_sprite()
# Walkaround for weird jsonfield 'no-decode' optimization.
self.sponsors = json.loads(self.sponsors)
self.render_sprite()
@@
-102,6
+103,5
@@
class SponsorPage(models.Model):
def flush_includes(self):
flush_ssi_includes(['/sponsors/page/%s.html' % self.name])
def flush_includes(self):
flush_ssi_includes(['/sponsors/page/%s.html' % self.name])
- def __
unicode
__(self):
+ def __
str
__(self):
return self.name
return self.name
-