Coder Social home page Coder Social logo

django-photologue's People

Watchers

 avatar

django-photologue's Issues

Error "raise NoReverseMatch"

What steps will reproduce the problem?
1. Insert an entry in model Photo
2. open an python shell
3. import your Photo Model
4. query your model with get => p = Photo.objects.get(pk=1)
5. p.get_absolute_url()

What is the expected output? What do you see instead?
expected output => no error
I see => "raise NoReverseMatch"

What version of the product are you using? On what operating system?
latest django svn version
latest photologue svn version

Please provide any additional information below.

>>> p = Photo.objects.get(pk=1)
>>> p.image
u'photologue/photos/2008/Mar/09/20080430.jpg'
>>> p.get_absolute_url()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/django/utils/functional.py", line
55, in _curried
    return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
  File "/usr/lib/python2.5/site-packages/django/db/models/base.py", line
478, in get_absolute_url
    return settings.ABSOLUTE_URL_OVERRIDES.get('%s.%s' % (opts.app_label,
opts.module_name), func)(self, *args, **kwargs)
  File "/home/bernd/Programming/vipe_django/photologue/models.py", line
247, in get_absolute_url
    return reverse('pl-photo-detail', args=args)
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py", line
297, in reverse
    return iri_to_uri(u'/' + get_resolver(urlconf).reverse(viewname, *args,
**kwargs))
  File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py", line
284, in reverse
    raise NoReverseMatch
NoReverseMatch

Original issue reported on code.google.com by [email protected] on 9 Mar 2008 at 1:42

Add some template tags

Hi,
I've created some template tags for photologue. My idea was to use
photologue as a central repository of images which I then can reference in
any template with (for example):

{% get_rotating_photo 'splash-page-gallery' 'splash_page' 'splash_img' %}

The above example is taken from the splash page at
http://www.londonbellydancer.co.uk/ - each time the page loads, a photo is
picked at random from gallery 'splash-page-gallery'.

The library that I've written contains 2 tags - one loads a photo, the
other a photo from a gallery.
More detailed instructions on use are included in the source code for each tag.
The code is still a bit rough, for example the input could be made more
flexible, but I think that even in its current state it may be useful to
other people.

Let me know what you think!
Richard




Original issue reported on code.google.com by [email protected] on 5 Mar 2008 at 11:47

Attachments:

EXIF parsing lacks error handling

What steps will reproduce the problem?
1. create a JPEG with an EXIF DateTimeOriginal of '2007:06:14 18:03: 6'
2. try to add it to a photologue gallery

What is the expected output? What do you see instead?
Should either parse or ignore badly formed date-time string.
Crashes with
Traceback (most recent call last):
  File "test.py", line 76, in test
    Photo.objects.create(image='test.jpg', title='Test', slug='test')
  File "django/db/models/manager.py", line 75, in create
    return self.get_query_set().create(**kwargs)
  File "django/db/models/query.py", line 274, in create
    obj.save()
  File "photologue/models.py", line 399, in save
    d, t = str.split(exif_date.values)
ValueError: too many values to unpack


What version of the product are you using? On what operating system?
Revision 185 on Ubuntu 7.10 Gutsy.


Please provide any additional information below.
The JPEG originates from an HP ScanJet 4600 scanner. Probably their
scanning software has a bug. I think it would be best to use the current
date/time if parsing fails.

Original issue reported on code.google.com by [email protected] on 29 Mar 2008 at 11:56

initial_data error

What steps will reproduce the problem?
1. new install photologue
2. ./manage.py syncdb
3.

What is the expected output? What do you see instead?
Installing xml fixture 'initial_data' from
'/home/remik/django/django_projects/dgallery/photologue/fixtures'.
Problem installing fixture
'/home/remik/django/django_projects/dgallery/photologue/fixtures/initial_data.xm
l':
(1452, 'Cannot add or update a child row: a foreign key constraint fails
(`remik_gallery/photologue_photosize`, CONSTRAINT
`effect_id_refs_id_73980e0b` FOREIGN KEY (`effect_id`) REFERENCES
`photologue_photoeffect` (`id`))')

What version of the product are you using? On what operating system?
1.0b

Please provide any additional information below.
photologue_photoeffect should be first install than photologue_photosize

Original issue reported on code.google.com by [email protected] on 14 Mar 2008 at 9:03

Patch to run under python-2.4

Hello, i tried using django-photologue and i was getting syntax errors. It
seems that your code relies on a Python-2.5 idiom (conditional
expressions)on 2 occasions in models.py. I see no important reason why it
should be restricted to python 2.5 , so here is a patch to make it
compatible with python 2.4.

Thank you for photologue. I am testing it just now, but it seems to be just
what i wanted.


Kostantinos Metaxas

Original issue reported on code.google.com by [email protected] on 29 Aug 2007 at 2:43

Attachments:

expand photo-information

It would be cool if there are possibilities to add extra infos to photos.
e.g. date/time the photo was taken,...

A nice feature could be to read this information from the picture meta
infos (Exif, IPTC, XMP). This could be usefull for the bulk gallery-upload
with a zip-file

Original issue reported on code.google.com by [email protected] on 28 Oct 2007 at 1:51

Support for Sites framework

Just wondering if you're planning to support Django's Sites framework.  This 
app is awesome -- 
except it's totally useless my company at the moment because all our django 
apps work with the 
sites framework (like Flatpages).

Original issue reported on code.google.com by kyle.fox on 3 Apr 2008 at 3:46

Default photo sizes

This should be default in fixtures:

Step 4 - Define The Photo Sizes

The example templates require you to define two additional photo sizes.
First define a new photo size and name it "thumbnail", you can size it
however you want, add an effect, as long as the name is "thumbnail". Next
do the same except name the photo size "display". This is the larger
version your users will click-through to see from your galleries.

Original issue reported on code.google.com by [email protected] on 14 Mar 2008 at 11:59

Prevent resizing if image is already at the right size

First, thanks for the great tool -- I scrapped my gallery implementation in
the favor of yours :)

(ver 0.5)

I just hit one issue -- if one requests size which is the same as original
image size image gets saved again in the cache which in the case of the
jpeg images cause additional loss of quality.

Quick fix is to add following after 'new_width, new_height =
photosize.size()' in create_size (models.py L220):

if (cur_width == new_width) and (cur_height == new_height):
# prevent resize if w/h are already right, just copy it with new name
    import shutil
    shutil.copy(self.get_image_filename(), getattr(self, "get_%s_path" %
photosize.name)())
    return

So original image is copied in the cache instead of re-saving.

(if needed I can re-submit this as a proper diff)

Original issue reported on code.google.com by [email protected] on 5 Dec 2007 at 3:12

2.0 branch: code errors/warnings

What steps will reproduce the problem?
1. pyflakes photologue

What is the expected output? What do you see instead?
No unused imports, no undefined names
There are some unused imports and undefined names

What version of the product are you using? On what operating system?
2.0 branch (svn revision 191)

Please provide any additional information below.
./photologue/pl-admin.py:7: redefinition of unused 'sys' from line 1
./photologue/pl-admin.py:17: 'PhotoSize' imported but unused
./photologue/pl-admin.py:34: undefined name 'caches'
./photologue/pl-admin.py:48: 'PhotoSize' imported but unused
./photologue/models.py:30: 'ValidationError' imported but unused

Original issue reported on code.google.com by [email protected] on 9 May 2008 at 10:11

i18n support

Will be nice if names and descriptions have i18n support.
I will use photologue in Polish website so I will do i18n localy. I can
than send you. I should it from trunk or 2.0 branch?

Original issue reported on code.google.com by [email protected] on 14 Mar 2008 at 10:29

prepopulate_from= won't work after newforms-admin merge

What steps will reproduce the problem?
1. use the Django newforms-admin branch
2. install photologue from the 2.0 branch

What is the expected output? What do you see instead?
There's an exception on the prepopulate_from= field keyword in models.py.

What version of the product are you using? On what operating system?
2.0 branch, revision 188.

Please provide any additional information below.
In newforms-admin, the prepopulate_from= field keyword is moved to the new
Admin class instead of being specified as a field keyword. See:
http://code.djangoproject.com/wiki/NewformsAdminBranch#Changedprepopulate_fromto
bedefinedintheAdminclassnotdatabasefieldclasses

Removing the prepopulate_from= keyword will be the only required change
when newforms-admin lands into trunk (as long as admin for photologue
models is not needed, and provided no more backwards incompatible changes
are introduced in newforms-admin).

Would it make sense to create a newforms-admin compatible branch of
photologue 2.0 already now?

Original issue reported on code.google.com by [email protected] on 17 Apr 2008 at 8:43

IOError at /photo/some_photo encoder error -2 when writing image file

sometimes an ioerror is raised for resizing a 'display' sized picture.

exception look like this:

{{{
...
File "/var/www/site/photologue/models.py", line 232, in _get_SIZE_url
    self.create_size(photosize)

  File "/var/www/site/photologue/models.py", line 317, in create_size
    'JPEG', quality=photosize.quality, optimize=True)

  File "/usr/lib/python2.4/site-packages/PIL/Image.py", line 1305, in save
    save_handler(self, fp, filename)

  File "/usr/lib/python2.4/site-packages/PIL/JpegImagePlugin.py", line 409,
in _save
    ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)])

  File "/usr/lib/python2.4/site-packages/PIL/ImageFile.py", line 491, in _save
    raise IOError("encoder error %d when writing image file" % s)

IOError: encoder error -2 when writing image file
}}}

see
http://groups.google.com/group/django-photologue/browse_thread/thread/6303aa8190
985f8d
for full discussion.

in message
http://mail.python.org/pipermail/image-sig/2006-October/004164.html of the
PIL mailinglist for this known issue the following (second) workaround is
proposed.

i build a patch for photoloque models.py to use the second workaround,
enlarging the MAXBLOCK buffer of ImageFile when needed. The first
workaround does not seem to apply here as it is not using the progressive
keyword, but maybe progressive=0 might help too.

The MAXBLOCK buffer is only enlarged when the problem (and only this
problem) is encountered. Although in a persistent setup like mod_python or
mod_wsgi daemons this setting will also persist after the first time it's set.

I'm not quite sure what the memory implications of this are, hopefully
there are non or small as i guess it's more of a resize buffer or at least
allocated when needed, but i need to read through the PIL code to be sure.

If it's a growing buffer it might be 'better' to put this work around in
the top of models.py so the entire try-except block is not needed and the
code is less cluttered.

the patch is attached for anyone wanting to try this out. so far i didn't
have any trouble after setting MAXBLOCK to 256*1024 but for larger pictures
something like 1024*1024 might be needed.

- trbs

Original issue reported on code.google.com by [email protected] on 3 Feb 2008 at 2:09

Attachments:

Photosize with 0,0 width/height produces MemoryError.

What steps will reproduce the problem?
1. Set photosize "foo" with height and width == 0
2. Attempt to display an image with size "foo", or call
Photo.objects.all()[0].create_size("foo")


What is the expected output? What do you see instead?

One expects a resized image to be returned, but instead a MemoryError is
raised.

What version of the product are you using? On what operating system?

revision 10, Debian GNU/Linux (Lenny), python-imaging (1.1.6-1)

Original issue reported on code.google.com by david%[email protected] on 20 Oct 2007 at 5:21

Attachments:

urls are not joined intelligently

hello, thanks for sharing this code.

my MEDIA_URL has a trailing slash. because of this Photo.image_url() emits
double slashes. i changed the method like below and it seems to work.
please consider fixing it. thanks. konstantin
{{{
    def image_url(self):
        from urlparse import urljoin
        return urljoin(settings.MEDIA_URL, self.image.replace('\\', '/'))
}}}

Original issue reported on code.google.com by [email protected] on 27 Sep 2007 at 6:30

Rounding errors in image size when cropping?

I think i'm getting a rounding error when cropping.
The height/width of the image (on whichever dimension is cropped) is often one 
pixel too large.

I changed the calculation of the box to use the given integer width and height 
to calculate the 
bottom right corner rather than using the calculated float difference and that 
seems to have solved 
it for me. though i haven't extensively tested it.

my change only addresses the problem when the crop is centered as i've only 
been using that.

Original issue reported on code.google.com by [email protected] on 26 Feb 2008 at 2:39

Attachments:

Thumbnail type error

The Admin thumbnail preview page didn't work here (Python 2.4, PIL 1.1.6,
Django 0.97pre-dev).

With this small patch, I could solve the problem. It's just the x_diff and
y_diff that I cast as int.

Original issue reported on code.google.com by [email protected] on 11 Sep 2007 at 11:10

Attachments:

Start zip gallery at 1

When uploading a gallery as a zip file, photo are numbered started at 0. As
these photo numbers are then visible to end users, I reckon that it would
be better to start numbering at 1.

Original issue reported on code.google.com by [email protected] on 29 Feb 2008 at 11:26

Attachments:

get_*_size() doesn't return an int 2-tuple

What steps will reproduce the problem?
1. get a Photo instance p
2. call p.get_display_size()

What is the expected output? What do you see instead?
Should return e.g. (200, 200).
Returns <bound method PhotoSize.size of <PhotoSize: display>>

What version of the product are you using? On what operating system?
2.0 branch revision 185 on Ubuntu 7.10 Gutsy.

Please provide any additional information below.
Probably just parentheses missing from the _get_SIZE_size() method's call
to photosize.size().

Original issue reported on code.google.com by [email protected] on 29 Mar 2008 at 5:42

Add filter_interface=models.HORIZONTAL to any ManyToManyField

Just a suggestion but adding a filter_interface to ManyToManyFields would
make it easier for users to select objects and add them. Here is the code
to add to the ManyToManyField to make it work:

filter_interface=models.HORIZONTAL

of

filter_interface=models.VERTICAL

I personally prefer horizontal.

Original issue reported on code.google.com by [email protected] on 16 Mar 2008 at 7:35

no way to get actual size of resized photo

What steps will reproduce the problem?
1. get a Photo object p
2. call e.g. p.get_display_size() (with fix from Issue 42)

What is the expected output? What do you see instead?
The actual size of the photo would be useful for the width= and height=
attributes of an <img> tag.
The method returns the maximum size of the given PhotoSize instead.

What version of the product are you using? On what operating system?
2.0 branch revision 185 on Ubuntu 7.10 Gutsy.

Please provide any additional information below.
This attachment modifies get_*_size() methods to return actual sizes.

Original issue reported on code.google.com by [email protected] on 29 Mar 2008 at 6:20

Attachments:

Media URL not being prepended

What steps will reproduce the problem?
1. Media URL not at root of domain
2. Media folder (inside "public_html") is a symbolic link back to
"public_html" folder.
3. nginx Web Server (location /media/: root is pointed to the "public_html"
folder)

What is the expected output? What do you see instead?
When you view an image, it does not give you the right URL. I would need to
prepend /media/ to the URL it produces to get the image.

What version of the product are you using? On what operating system?
1.0b. Ubuntu Gusty 7.10

Please provide any additional information below.
If I defined PHOTOLOGUE_DIR = "media/photologue", then it would produce
correct URLS.

Original issue reported on code.google.com by [email protected] on 20 Mar 2008 at 5:58

Performance problem

Hi,

photologue make too many queries to database. In function  
def _get_SIZE_url(self, size):
it does:
            photosize = PhotoSize.objects.get(name=size)

for every photo. I have about 500 photos on page(and over 500 queries per 
request)  and high traffic can kill my database server. How to solve it?

Sorry for my english :/

Original issue reported on code.google.com by [email protected] on 12 Feb 2008 at 11:39

Is it possible to use Unix style line delimiters?

What steps will reproduce the problem?
1. checkout trunk (or 2.0 branch) on a linux system
2. cat -v models.py | more

What is the expected output? What do you see instead?
I would not see any nonprinting characters, but I can see ^M as line delimiters

What version of the product are you using? On what operating system?
2.0 branch (svn revision 191)

Please provide any additional information below.
tools like pyflakes or python-coverage have problems with this line delimiters

Original issue reported on code.google.com by [email protected] on 9 May 2008 at 10:18

titles must be unique across galleries

What steps will reproduce the problem?
1. create two galleries
2. upload a photo to each of the galleries, both photos with identical titles

What is the expected output? What do you see instead?
Uploading the second photo fails, because there's a unique=True constraint
in the Photo model.

What version of the product are you using? On what operating system?
2.0 branch revision 188.

Please provide any additional information below.
I don't think there should be any limitation to the photo title. At least
the requirement for the title not to be identical to any photo in any
gallery feels too strict.

A developer might even want to implement photo galleries in which photos
have no titles at all, just filenames. For such a case, "null=True,
blank=True" for the title would make sense.

Different constraints could still be enforced in the upload form by the
developer.

Original issue reported on code.google.com by [email protected] on 19 Apr 2008 at 7:26

Maths for cropping seem to be incorrect

The calculation of ratio when cropping an image seems to be incorrect.

I had a photosize of 837x359 with crop set and a much larger photo (3072x2048).
the generated size of the image for the photo was coming out at 250x359 (and 
cropped from a 
strange x offset)
obviously I expected the image to be 837x359

this is using r113.

looking at the create_size method i think the following should be used for 
calculating the ratio:

ratio = max(float(new_width)/cur_width,float(new_height)/cur_height)

i think this is right, it's generating the expected image for me.

i've attached my svn diff

Original issue reported on code.google.com by [email protected] on 26 Feb 2008 at 4:52

Attachments:

Resizing PNG images

What steps will reproduce the problem?
1. Upload some PNG
2. Try to display it in some of the PhotoSize

What is the expected output? What do you see instead?
You should see resized image. Instead of it you see nothing (resized image
in cache dir have only 8 bytes).

What version of the product are you using? On what operating system?
Latest version; FreeBsd 5.4

Please provide any additional information below.
You must repair lines 206 and 207 in file models.py:

box = (x_diff, y_diff, int(x-x_diff), int(y-y_diff))
resized = im.resize((int(x), int(y)), Image.ANTIALIAS).crop(box)

Original issue reported on code.google.com by [email protected] on 18 Oct 2007 at 12:03

Attachments:

folder structure

Currently templates are in not correct place. It should be the same as in
2.0 branch.

Original issue reported on code.google.com by [email protected] on 14 Mar 2008 at 11:19

Creating a photo size with checked "pre-cache" option

What steps will reproduce the problem?
1. create a new photo size entry (e.g: name=test)
2. check the "pre-cache" option and save it

What is the expected output? What do you see instead?
expected output would be a saved photo size entry
But there is the following error:
'Photo' object has no attribute 'get_test_path'

What version of the product are you using? On what operating system?
1b

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 13 Mar 2008 at 6:47

Problem with gallery upload of OSX-compressed ZIPs

What steps will reproduce the problem?
1. Archive photos in OS X
2. Upload as a GalleryUpload

OS X makes a file for every file which contains bits of metadata about it. It 
stores this in the 
folder but it's not generally visible on OS X. If you extract a ZIP made with 
OS X on a Windows PC 
or something you'll see these files.

Photologue makes an Image entry for these files, which leads to, in my case, a 
ZIP of 35 images 
actually creating 70 Image entries in the DB, but only half of them are 'real'. 
The others point to 
these meta files which aren't images at all.

You should consider modifying the code to not include the file if it starts 
with a '.' (as the OS X 
meta files do)

Original issue reported on code.google.com by [email protected] on 21 Oct 2007 at 9:30

photosize.name passed instead of photosize

What steps will reproduce the problem?
1. python pl-admin.py -s=display create

What is the expected output? What do you see instead?
/usr/lib/python2.5/site-packages/photologue/models.py in create_size(self,
photosize)
    284         if im.size == photosize.size():
    285             shutil.copy(self.get_image_filename(),
--> 286                         self._get_SIZE_path(photosize.name))
    287             return
    288         cur_width, cur_height = im.size

/usr/lib/python2.5/site-packages/photologue/models.py in
_get_SIZE_path(self, photosize)
    248     def _get_SIZE_path(self, photosize):
    249         return os.path.join(self.cache_path(),
--> 250                            
self._get_filename_for_size(photosize.name))
    251
    252     def add_accessor_methods(self, *args, **kwargs):

I think the wrong one is 286, only photosize should be passed as an argument.

What version of the product are you using? On what operating system?
r115 on Ubuntu (Geodjango)

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 28 Feb 2008 at 4:30

Enable "save_on_top" in Models

Just a small feature request:

Add save_on_top = True to all models to improve usability. For each model
you can add a save bar at the top by declaring:

--- BEGIN ----------------------------------------

class ModelName(models.Model):
    .....

    class Admin:

        save_on_top = True

--- END ----------------------------------------

This is not really anything import but just an idea.

Thanks,
blis102

Original issue reported on code.google.com by [email protected] on 14 Mar 2008 at 10:20

Make slugs unique

Change Gallery and Photo models so that the slug fields are unique.
This has benefits for when you want to refer to galleries/photos from other
applications - for example, I've got a project with a basic CMS system in
which users can pick a photo (stored in photologue) to be displayed. Using
slugs is a lot more 'user friendly' than using numerical photo ids. 

Original issue reported on code.google.com by [email protected] on 1 Mar 2008 at 12:08

Attachments:

Import path

Currently you import modeles in urls.py like this:

from django_apps.photologue.models import Gallery, Photo

and with this your app must be in the specific path to work.

If you change this to:

from models import Gallery, Photo

you can remove requirement to install this app in django_apps/photologue.

Original issue reported on code.google.com by [email protected] on 5 Dec 2007 at 3:16

no way to get actual size of resized photo

What steps will reproduce the problem?
1. get a Photo object p
2. call e.g. p.get_display_size() (with fix from Issue 42)

What is the expected output? What do you see instead?
The actual size of the photo would be useful for the width= and height=
attributes of an <img> tag.
The method returns the maximum size of the given PhotoSize instead.

What version of the product are you using? On what operating system?
2.0 branch revision 185 on Ubuntu 7.10 Gutsy.

Please provide any additional information below.
This attachment modifies get_*_size() methods to return actual sizes.

Original issue reported on code.google.com by [email protected] on 29 Mar 2008 at 6:25

Attachments:

Display Field Suggestion

Just a suggestion but it might be a good idea to have a BooleanField for
displaying the picture. So you could have a form for people to upload
pictures but not automatically display on the website.

Original issue reported on code.google.com by [email protected] on 27 Oct 2007 at 7:33

Saving photo size

What steps will reproduce the problem?
1. Add new photo size
2. Save with name "thumbnail"


What is the expected output? What do you see instead?
Traceback:
File "/home/remik/django/django_src/django/core/handlers/base.py" in
get_response
  82.                 response = callback(request, *callback_args,
**callback_kwargs)
File
"/home/remik/django/django_src/django/contrib/admin/views/decorators.py" in
_checklogin
  62.             return view_func(request, *args, **kwargs)
File "/home/remik/django/django_src/django/views/decorators/cache.py" in
_wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "/home/remik/django/django_src/django/contrib/admin/views/main.py" in
add_stage
  264.             new_object = manipulator.save(new_data)
File "/home/remik/django/django_src/django/db/models/manipulators.py" in save
  109.         new_object.save()
File "/home/remik/django/django_projects/dgallery/photologue/models.py" in save
  521.         self.clear_cache()
File "/home/remik/django/django_projects/dgallery/photologue/models.py" in
clear_cache
  515.                 photo.create_size(self)
File "/home/remik/django/django_projects/dgallery/photologue/models.py" in
create_size
  353.         resized_filename = getattr(self, "get_%s_path" %
photosize.name)()

Exception Type: AttributeError at /panel/photologue/photosize/add/
Exception Value: 'Photo' object has no attribute 'get_thumbnail_path'

What version of the product are you using? On what operating system?
1.0b

Please provide any additional information below.

Index: photologue/models.py
===================================================================
--- photologue/models.py    (revision 172)
+++ photologue/models.py    (working copy)
@@ -297,7 +297,7 @@
         return False

     def create_size(self, photosize):
-        if self.size_exists(photosize):
+        if not self.size_exists(photosize):
             return
         if not os.path.isdir(self.cache_path()):
             os.makedirs(self.cache_path())

Original issue reported on code.google.com by [email protected] on 14 Mar 2008 at 11:45

Add def __str__(self) to Photo and Gallery classes

I noticed (at least in Django 0.96) that when you add a gallery and you
select the photos you want in the gallery, it says something to the effect
of "Photo object". This makes it quite difficult to decide which photo to
add if they all say "Photo object" rather than their title. If you add the
line below, it will display the photos title instead of "Photo object".

Add this to class Gallery and class Photo in models.py:
    def __str__(self):
        return self.title

Original issue reported on code.google.com by [email protected] on 16 Mar 2008 at 7:22

Are the imports from PIL correct?

Hi,
In photologue the imports from PIL are defined as:
import Image
import ImageFile
import ImageFilter

When I first used photologue I had to change this to:
from PIL import Image
from PIL import ImageFile
from PIL import ImageFilter

to get it to work on my mac. I thought at first it was a mac idiosyncrasy,
but since then I've noticed that 'from PIL import' is also needed for
Ubuntu, and is also the syntax used in Django-trunk. So I'm starting to
wonder if 'import Image' is the oddball case, not the other way round :-)

Comments anyone?

Richard

Original issue reported on code.google.com by [email protected] on 1 Mar 2008 at 12:24

Adding GIF (or other file PIL does not understand) breaks "Photos" in admin

What steps will reproduce the problem?
1. create .zip with some jpg files and some gifs
2. upload gallery
3. go to Photos in admin

What is the expected output? What do you see instead?

- view of photos gallery is expected, python error screen is displayed instead.

What version of the product are you using? On what operating system?
current stable Ubuntu+svn django

Please provide any additional information below.

here's output from django debug:


ValueError at /admin/photologue/photo/
cannot filter palette images
Request Method:     GET
Request URL:    http://localhost:8080/admin/photologue/photo/
Exception Type:     ValueError
Exception Value:    cannot filter palette images
Exception Location:     /usr/lib/python2.5/site-packages/PIL/ImageFilter.py in
filter, line 54
Python Executable:  /usr/bin/python
Python Version:     2.5.1
Python Path:    ['/home/ted/expclub', '/usr/lib/python25.zip',
'/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2',
'/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload',
'/usr/local/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages',
'/usr/lib/python2.5/site-packages/Numeric',
'/usr/lib/python2.5/site-packages/PIL',
'/usr/lib/python2.5/site-packages/gst-0.10',
'/var/lib/python-support/python2.5',
'/usr/lib/python2.5/site-packages/gtk-2.0',
'/var/lib/python-support/python2.5/gtk-2.0']
Template error

In template
/usr/lib/python2.5/site-packages/django/contrib/admin/templates/admin/change_lis
t.html,
error at line 18
Caught an exception while rendering: cannot filter palette images
8   <div id="content-main">
9   {% block object-tools %}
10  {% if has_add_permission %}
11  <ul class="object-tools"><li><a href="add/{% if is_popup %}?_popup=1{%
endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name|escape as
name %}Add {{ name }}{% endblocktrans %}</a></li></ul>
12  {% endif %}
13  {% endblock %}
14  <div class="module{% if cl.has_filters %} filtered{% endif %}"
id="changelist">
15  {% block search %}{% search_form cl %}{% endblock %}
16  {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}
17  {% block filters %}{% filters cl %}{% endblock %}
18  {% block result_list %}{% result_list cl %}{% endblock %}
19  {% block pagination %}{% pagination cl %}{% endblock %}
20  </div>
21  </div>
22  {% endblock %}
23  

Original issue reported on code.google.com by [email protected] on 29 Feb 2008 at 4:12

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.