Re: Problem updating data

2011-08-27 Thread Blue
My first thought is that you didn't call parent save method in you
custom save method

super(YourClass, self).save(*args, **kwargs)


On 26 Sie, 03:59, Karen McNeil  wrote:
> Thank you Malcolm, you were exactly right!
>
> I would have never thought of that, but I have a custom save method
> and when I commented it out and restarted the app, setting the active
> property worked just as expected.  Now I just have to figure out what
> the hell is wrong with my save method... :-)
>
> Thank you!
>
> ~Karen
>
> On Aug 24, 8:31 pm, Malcolm Box  wrote:
>
>
>
>
>
>
>
> > Instead of counting the inactive, try counting the active ones. If that
> > count doesn't go up by one, I'd suspect something's dodgy in your Entry
> > model's save() that means it doesn't write successfully to the db.
>
> > You could debug by doing:
>
> > from django.db import connection
> > connection.queries
> > e1.save()
> > connection.queries
>
> > to see what the SQL generated was.
>
> > Then start looking at your database to see what it's doing.
>
> > Malcolm
>
> > On 23 August 2011 23:08, Karen McNeil  wrote:
>
> > > No, that's not the problem. Even if I redo the query now, I still get
> > > the same count (see below). And, like I said, the change does not show
> > > up in the admin either -- THE VALUE HAS NOT BEEN CHANGED.
>
> > > This behavior is so unexpected I'm not sure how to even begin trouble-
> > > shooting it.
>
> > > ~Karen
>
> > > PS -- What's wrong with querying by "active=0"? I did it that way
> > > because that's what the admin interface does for filters... is there
> > > any difference?
>
> > > NEW SHELL SESSION FROM TODAY, TESTING SAME THING:
>
> > > >>> from dictionary.models import Entry
> > > >>> entries = Entry.objects.filter(active=False)
> > > >>> entries.count()
> > > 3642
> > > >>> e1 = entries[0]
> > > >>> e1
> > > 
> > > >>> e1.active
> > > False
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > Malcolm Box
> > malcolm@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sorl thumbnail

2011-06-11 Thread Blue Cuenca
Is your cache, readable and writable to other groups/users as well?

On 6/11/2011 1:11 AM, Greg Donald wrote:
> On Fri, Jun 10, 2011 at 11:59 AM, Greg Donald  wrote:
>>  File "/usr/local/lib/python2.6/dist-packages/PIL/ImageFile.py", line
>> 52, in raise_ioerror
>>   raise IOError(message + " when reading image file")
>>
>> IOError: broken data stream when reading image file
> 
> 
> And then more baffling is the fact that it works using `manage.py shell`
> 
> 
> In [1]: from sorl.thumbnail import get_thumbnail
> 
> In [2]: im = 
> get_thumbnail('/myproject/static/images/user_profiles/1/11-20-2010-2_5.jpg',
> '32x32', crop='center' )
> 
> In [3]: im
> Out[3]: 
> 
> In [4]: im.url
> Out[4]: 'http://example.com/cache/ff/31/ff318b4a995ff345d1d48e79b67ec62b.jpg'
> 
> It made the thumbnail, just won't make one via the template code.
> 
> 
> 


-- 
Your eyes are weary from staring at the CRT. You feel sleepy.  Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. You cannot imagine why you ever felt
otherwise.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help getting started.....I think it is installed correctly

2011-01-01 Thread Blue Cuenca
/home/mycode or /home is a linux location.  Apparently, you are using
windows.

I would suggest creating a folder for all your django projects, say
C:\DjangoProjects\ , and run django-admin.py from there.

You do not want to put your django project folder in your www folder,
since that may allow access to the sources themselves, instead of
running them to create the html.


On 1/2/2011 12:14 AM, Anthony Pearce wrote:
> Quote from "Writing your first Django app, part 1":
> 
>>From the command line, cd into a directory where you’d like to store
> your code, then run the command django-admin.py startproject mysite.
> This will create a mysite directory in your current directory.
> 
> Put your code in some directory outside of the document root, such as /
> home/mycode.
> 
> 
> OK, please explain where /hom/mycode should be located.  Is it
> directly on the C:, or like I have a www folder for playing with html,
> or within the Python directory somewhere?   Sorry, but I'm looking at
> this again for the first time in over a year, and need a bump start.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Save Handlers and a newbie to Django

2010-10-15 Thread Blue Cuenca
 On 10/15/2010 9:01 PM, Devin M wrote:
> Hello everyone,
> I am writing a save handler in my models.py file to run a few
> actions after a save. to do this I have a function called make_photos
> and a connection to the post_save signal.
> Here is my code:
>
> 
> The only problem i have with this code is that it runs every save. So
> it creates a infinite loop of sorts and I dont know how to make it
> perform this action once. Is there another signal I should use? Any
> ideas?
>
> Regards,
> Devin M
>
You may want to look at this:
http://snipt.net/danfreak/generate-thumbnails-in-django-with-pil/

The snippet above overrides the save method.  Before calling the actual
save (super), the thumbnail fields is dynamically created (using PIL). 
I am sure you can add code that will do the same thing for your "large"
photo field.


regards,
Blue C

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.