Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Django Favicon Plus Reloaded
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Libraries
Django Favicon Plus Reloaded
Commits
f18ed54e
Commit
f18ed54e
authored
9 years ago
by
Philippe O. Wagner
Browse files
Options
Downloads
Plain Diff
Merge pull request
#3
from bashu/master
added python 3 compatibility
parents
57c0c106
75a04c71
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
favicon/models.py
+7
-5
7 additions, 5 deletions
favicon/models.py
with
7 additions
and
5 deletions
favicon/models.py
+
7
−
5
View file @
f18ed54e
from
compat
import
python_2_unicode_compatible
from
compat
import
python_2_unicode_compatible
from
django.db
import
models
from
django.db
import
models
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.files.uploadedfile
import
InMemoryUploadedFile
from
PIL
import
Image
from
PIL
import
Image
import
StringIO
try
:
from
django.core.files.uploadedfile
import
InMemoryUploadedFile
from
StringIO
import
StringIO
except
ImportError
:
from
io
import
StringIO
config
=
{
config
=
{
'
shortcut icon
'
:
[
16
,
32
,
48
,
128
,
192
],
'
shortcut icon
'
:
[
16
,
32
,
48
,
128
,
192
],
...
@@ -63,7 +66,7 @@ class Favicon(models.Model):
...
@@ -63,7 +66,7 @@ class Favicon(models.Model):
tmp
=
Image
.
open
(
self
.
faviconImage
.
path
)
tmp
=
Image
.
open
(
self
.
faviconImage
.
path
)
tmp
.
thumbnail
((
size
,
size
),
Image
.
ANTIALIAS
)
tmp
.
thumbnail
((
size
,
size
),
Image
.
ANTIALIAS
)
tmpIO
=
StringIO
.
StringIO
()
tmpIO
=
StringIO
()
tmp
.
save
(
tmpIO
,
format
=
'
PNG
'
)
tmp
.
save
(
tmpIO
,
format
=
'
PNG
'
)
tmpFile
=
InMemoryUploadedFile
(
tmpFile
=
InMemoryUploadedFile
(
tmpIO
,
None
,
'
fav-%s.png
'
%
tmpIO
,
None
,
'
fav-%s.png
'
%
...
@@ -103,7 +106,6 @@ class FaviconImg(models.Model):
...
@@ -103,7 +106,6 @@ class FaviconImg(models.Model):
self
.
faviconImage
.
delete
()
self
.
faviconImage
.
delete
()
from
django.db.models
import
signals
from
django.db.models
import
signals
from
django.db.models.signals
import
pre_delete
from
django.db.models.signals
import
pre_delete
from
django.dispatch.dispatcher
import
receiver
from
django.dispatch.dispatcher
import
receiver
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment