Re: Signal for 'ready to receive requests'
On 6/1/07, Doug B <[EMAIL PROTECTED]> wrote: > > I've been looking around the limited signals documentation and the > code hoping to find a signal that basically says 'django is done > importing models ready to receive requests', but haven't found it > yet. The closest I've found is connecting a receiver to > request_started, and then removing that receiver after the first > call... but that isn't quite what I was looking for. > > Is it there or should I keep looking? If it's not there, would this > be something useful to consider adding? I've never worked with > signals before, so you may have to type slowly so I can understand. There is no existing signal that does what you are asking for. What you are asking for is a pretty unusual request, and I can't say I can see any particilar reason why it should be required... do you mind if we ask what it is you are trying to do? Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Signal for 'ready to receive requests'
I've been looking around the limited signals documentation and the code hoping to find a signal that basically says 'django is done importing models ready to receive requests', but haven't found it yet. The closest I've found is connecting a receiver to request_started, and then removing that receiver after the first call... but that isn't quite what I was looking for. Is it there or should I keep looking? If it's not there, would this be something useful to consider adding? I've never worked with signals before, so you may have to type slowly so I can understand. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Where did you put your homepage view?
?python,???asii --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Too many queries generated by ChangeManipulator
On 6/1/07, char <[EMAIL PROTECTED]> wrote: > > Obviously, the performance deteriorates rapidly as the number of > GamesOfInterest added to a Profile increases. Is there any way to > avoid this? This is a known problem, and one of the many reasons that the forms framework is being replaced with 'newforms'. There is no workaround (that I am aware of), nor are there plans to fix the (many) problems with the Manipulator framework. If you are developing a new application, I _strongly_ recommend that you develop using newforms. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Too many queries generated by ChangeManipulator
I've got a model with a few foreign keys. Normally this isn't a problem except in one case when I create a Profile ChangeManipulator, it results on the following query repeated once per GameOfInterest associated with the given Profile: 'time': '0.046', 'sql': 'SELECT "game_room_app_game"."id","game_room_app_game"."name","game_room_app_game"."genre_id" FROM "game_room_app_game" ORDER BY "game_room_app_game"."name" ASC' Obviously, the performance deteriorates rapidly as the number of GamesOfInterest added to a Profile increases. Is there any way to avoid this? Here is the relevant portion of my model file (with some fields removed for brevity). Essentially, I have a GameOfInterest that associates a Profile to a Game, and a Profile can have any number of these: class Game( models.Model ): class Admin: pass class Meta: ordering = ( 'name', ) def __str__( self ): return self.name name = models.CharField( maxlength=60, unique=True ) genre = models.ForeignKey( GameGenre ) class Profile( models.Model ): class Admin: pass # waiting on bug #2076 #ordering = ( 'user__username' ) def __str__( self ): return self.user.username user = models.ForeignKey( User, unique=True, edit_inline=models.STACKED, max_num_in_admin=1, num_in_admin=1, core=True ) ) class GameOfInterest( models.Model ): class Admin: pass def __str__( self ): return self.game.name game = models.ForeignKey( Game, blank=False ) profile = models.ForeignKey( Profile, edit_inline=models.TABULAR, num_in_admin=1, core=True, blank=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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Cannot resolve keyword '___' into field
The solution I implemented for my app has worked without a hitch at the moment. Unfortunately the problem still persists in the admin. eg: when I log into the admin, the first page always shows up the 'Auth' and 'Sites' apps but intermittently shows up the app i've written. I would like to go through the admin and apply my fix to it. I'm just wondering what files I would have to look through. Do I only have to go through the django/contrib/admin/ folder and all the files in it? Regards, Mark. On 15/05/2007, at 7:33 PM, Malcolm Tredinnick wrote: On Tue, 2007-05-15 at 16:54 +1000, Mark Jarecki wrote: > The temporary fix that I've employed at the moment is e.g.: > > > Instead of > > >>> osIcons = >>> product.productOSIcons.filter(isPublished=True).order_by >>> ('osIconName') > > > I've got: > > > icons = ProductOSIcons.objects.filter(isPublished=True) > osIcons2 = [] > for icon in icons: > if Products.objects.filter(id=product.id, productOSIcons=icon, > isPublished=True): > osIcons2.append(icon) > > > Which is a REALLY ugly solution, but hopefully I wont have to use it > for too long. As the ticket you found suggests, we're aware of the problem and I think we understand the latest reason it's not working (middleware is introducing an extra curve-ball for some reason). Fixing it is very hard because the problem is so non-reproducible. It's quite likely that somebody running your exact code on a different machine or with a different version of Python will not be able to reproduce the problem. At the moment, I'm probably the most likely person to end up fixing this. However all my free time for Django is taken at the moment on some other items, so all I can encourage people who find these problems to do is try to shuffle things around a little, as you've done, in the hope of finding a workaround. Regards, Malcolm > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Should file uploads work in 0.96 admin?
I'm just wondering my expectations are correct: Using 0.96, given a model with an ImageField, the admin interface gives me (what looks to be) a file upload widget. I should be able to select a file from that widget, and once I save the model, it *should* copy my image file into the upload_to path, correct? many thanks, andrew --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: non-editable model elements and generic updates
Just ignore me. I like to overlook obvious bits then wonder why it isn't working. I was using "editable=False" in several of the fields I wanted to hide, but missed one. So the "editable=False" solution *is* the fix I was looking for, I just gooned it up by missing a field. :-) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
non-editable model elements and generic updates
What is the best practice for handling this? Let's say I have a form with 3 fields: name, b-day, status I want a form that will allow the user to edit "name" and "b-day", then keep "status" whatever it was before the edit. Should I send this through as a hidden field? Of course, I'm talking about a much larger model here, but simplifying for the sake of er... simplicity. Actually the model has about 15 elements and the user will be editing about 10. The problem is this: if all 15 fields are filled, and some are set to "editable=False", the form goes through fine, but all the fields not in the form are set to null, or otherwise wiped out. How can I get around this? Is my only option to pass all that info through as hidden fields? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Get_FIELD_url issues
Awright. I just know I'm missing something stupid here. I have a model for file attachments that are uploaded. In one of my templates, I'd like to display a URL whence the attachment could be recalled. So I've put in {{ a.get_bugfile_url }} in the template, but the output HTML looks like Title. I can't retrieve the URL. However, if I test this in the shell, calling a.get_bugfile_url(), I get exactly the URL I'm expecting. Interestingly, get_bugfile_filename also doesn't work in the template, but does in the shell. Anyone tell me what stupid thing I'm missing? I'm using the most current SVN version of django (trunk). Thanks, J --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: special session-time usecase
Ok, I just read into middleware a bit more and I see the possibilities now. I'm going to attempt to write this and I'll post the results once I'm done. This seems like something people might want at their disposal. Thanks for the assistance. ringemup wrote: > On May 31, 3:14 pm, tyman26 <[EMAIL PROTECTED]> wrote: > > That makes a lot more sense to me now, thanks for the explanation! > > The only thing that worries me is repetition. It seems like it would > > get very repetitive implementing this inside every view in the entire > > project. Is there somewhere else you can check everytime a request is > > made? > > I'm pretty certain that that's what middleware does. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Checking group permissions in template code
vida wrote: > After reading the docs and looking for posts relating this problem > here and in .developers, I found no "standard" way of checking for a > user's group permissions in the templates. > > So what I did is to add the following method to auth.models.User > (yeah, yeah, it *should* be in appname.models.UserProfile): > > def group_permissions(self): > class GroupPermissions: > def __init__(self, permissions): > for perm in permissions: > setattr(self, perm, True) > > def __str__(self): > return 'The user belongs to the following groups: %s' % \ > ', '.join([k for k, v in self.__dict__.iteritems()]) > > return GroupPermissions(self.get_group_permissions()) > > > which lets me write something like the following in my templates: > {% if user.group_permissions.permission_name %} draw custom menues for > this particular group here {% endif %} > > So, is there already a way to do this and I missed it? If not, given > that it is apparently not advisable (is it?) to extend the > auth.models.User class, how about we add it? maybe i'm missing something here, but is it really important for you to use only through-a-group gained permissions? isn't it enough to simply check for the given permission? because if it's enough, then simply use the "perms" variable in the templates. gabor --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Looking for Django Developers As Founders
Tim Chase <[EMAIL PROTECTED]> writes: >>> Sorry, my email is >> >> Ermmm It tells us that in the mail header. > > But it doesn't tell us where this is geographically in the > header, the body, or in the follow-up email :) It's in cyberspace, man. -- Nic Ferrier http://www.tapsellferrier.co.uk --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Looking for Django Developers As Founders
Michael Lim <[EMAIL PROTECTED]> writes: > Not in Google Groups. The email is masked off as shown in the reply > thread shown below :-) Bizarre! -- Nic Ferrier http://www.tapsellferrier.co.uk --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Moving Images to Amazon S3
One addition: On 31 mei, 21:35, SanPy <[EMAIL PROTECTED]> wrote: > Try this: > # in your view > raw_image_data = form.cleaned_data['photo']['content'] > thumbnail_content = resize_image(raw_image_data) > filename = form.cleaned_data['photo']['filename'] Change the filename's extension to jpg, because it gets converted to JPEG in resize_image: filename = os.path.splitext(filename)[0] + ".jpg" > upload_to_s3(filename, thumbnail_content) > > def resize_image(buf, size=(100, 100)): > f = cStringIO.StringIO(buf) > image = PILImage.open(f) > if image.mode not in ('L', 'RGB'): > image = image.convert('RGB') > image.thumbnail(size, PILImage.ANTIALIAS) > o = cStringIO.StringIO() > image.save(o, "JPEG") > return o.getvalue() > > def upload_to_s3(filename, filedata): > conn = S3.AWSAuthConnection(AWS_ACCESS_KEY_ID, > AWS_SECRET_ACCESS_KEY) > content_type = mimetypes.guess_type(filename)[0] > response = conn.put(BUCKET_NAME, '%s' % filename, > S3.S3Object(filedata), {'x-amz-acl': 'public-read', 'Content-Type': > content_type}) > > Regards, Sander. > > On 31 mei, 17:38, Kyle Fox <[EMAIL PROTECTED]> wrote: > > > I think my question wasn't clear: we're having NO problem putting > > files on S3, that's dead simple (ie what Holovaty blogged about). > > > What we need to do is take an *in-memory Image* and put it directly > > onto S3. We need a way to convert a PIL Image instance into a format > > S3 can accept WITHOUT having to first save the Image to the file- > > system. S3 accepts the kind of string that gets returned from > > open(afile).read() > > > I was trying to wrap the result of img.tostring() in the StringIO > > class, and then put that on S3, but that doesn't work either... --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Looking for Django Developers As Founders
Nic, Not in Google Groups. The email is masked off as shown in the reply thread shown below :-) Have a nice day! Cheers, Michael On Jun 1, 3:41 am, Nic James Ferrier <[EMAIL PROTECTED]> wrote: > Michael Lim <[EMAIL PROTECTED]> writes: > > Hi all, > > > Sorry, my email is > > > lim ck michael gmail com > > Ermmm It tells us that in the mail header. > > -- > Nic Ferrierhttp://www.tapsellferrier.co.uk --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Looking for Django Developers As Founders
>> Sorry, my email is > > Ermmm It tells us that in the mail header. But it doesn't tell us where this is geographically in the header, the body, or in the follow-up email :) -tim --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Looking for Django Developers As Founders
Michael Lim <[EMAIL PROTECTED]> writes: > Hi all, > > Sorry, my email is > > lim ck michael gmail com Ermmm It tells us that in the mail header. -- Nic Ferrier http://www.tapsellferrier.co.uk --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: special session-time usecase
On May 31, 3:14 pm, tyman26 <[EMAIL PROTECTED]> wrote: > That makes a lot more sense to me now, thanks for the explanation! > The only thing that worries me is repetition. It seems like it would > get very repetitive implementing this inside every view in the entire > project. Is there somewhere else you can check everytime a request is > made? I'm pretty certain that that's what middleware does. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Moving Images to Amazon S3
Try this: # in your view raw_image_data = form.cleaned_data['photo']['content'] thumbnail_content = resize_image(raw_image_data) filename = form.cleaned_data['photo']['filename'] upload_to_s3(filename, thumbnail_content) def resize_image(buf, size=(100, 100)): f = cStringIO.StringIO(buf) image = PILImage.open(f) if image.mode not in ('L', 'RGB'): image = image.convert('RGB') image.thumbnail(size, PILImage.ANTIALIAS) o = cStringIO.StringIO() image.save(o, "JPEG") return o.getvalue() def upload_to_s3(filename, filedata): conn = S3.AWSAuthConnection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) content_type = mimetypes.guess_type(filename)[0] response = conn.put(BUCKET_NAME, '%s' % filename, S3.S3Object(filedata), {'x-amz-acl': 'public-read', 'Content-Type': content_type}) Regards, Sander. On 31 mei, 17:38, Kyle Fox <[EMAIL PROTECTED]> wrote: > I think my question wasn't clear: we're having NO problem putting > files on S3, that's dead simple (ie what Holovaty blogged about). > > What we need to do is take an *in-memory Image* and put it directly > onto S3. We need a way to convert a PIL Image instance into a format > S3 can accept WITHOUT having to first save the Image to the file- > system. S3 accepts the kind of string that gets returned from > open(afile).read() > > I was trying to wrap the result of img.tostring() in the StringIO > class, and then put that on S3, but that doesn't work either... --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Looking for Django Developers As Founders
Hi all, Sorry, my email is lim ck michael gmail com Thanks, Michael On Jun 1, 3:14 am, Michael Lim <[EMAIL PROTECTED]> wrote: > Hi there, > > We are incubating a web startup, and we are looking for the talented, > entrepreneurial and passionate Django developers who are keen to be > part of a great founding team. > > With this job, you are able to: > * Work on the cutting edge of Web 2.0 development > * Be part of a founding team of an exciting startup > * Work with fun and innovative people who are just as passionate > about the web as you are!! > > We do not look not for technical competency, but rather, you must > possess a hunger to code, to succeed and be passionate. > > Just email me and I'll reply ASAP. :-) > > Have a nice weekend! > > Cheers, > Michael --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: special session-time usecase
That makes a lot more sense to me now, thanks for the explanation! The only thing that worries me is repetition. It seems like it would get very repetitive implementing this inside every view in the entire project. Is there somewhere else you can check everytime a request is made? On May 31, 1:39 pm, ringemup <[EMAIL PROTECTED]> wrote: > > I see what you are saying, but I want the user to be automatically > > logged out after a period of inactivity for security purposes. > > Yes, this accomplishes that. > > > 1) Do you mean I would check the last time they saved and then > > compare it with a time limit everytime they alter a session? > > Yes, basically, except that you're setting a session parameter on > every page load, which is what you're checking against, rather than > against the last time the user saved something. > > > 2) If the time limit has been surpassed, would I disallow the > > transaction and then log them out? > > Yes. > > > I was hoping there was another way where somehow the system would > > check constantly and expire old sessions and cookies automatically. > > I'm still unsure how something could sit in the background and check > > every minute, not sure if its even possible. > > Why would you need to actively cause them to expire, as long as > they're refused when someone tries to accomplish something with them? > If you log the user out upon any request after the expiration time, > you get the same effect. The session becomes an expired session > whether or not you delete the cookie, and whether or not the user ever > returns to the site. Not sure if I'm explaining this clearly. > > In pseudo-code... > > on every request: > if (session['last_activity'] > (now - 30min)): > user.logout() > session.destroy() > session.create() > session['last_activity'] = now > redirect('/login_url') > else: > session['last_activity'] = now > execute_requested_view() --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Looking for Django Developers As Founders
Hi there, We are incubating a web startup, and we are looking for the talented, entrepreneurial and passionate Django developers who are keen to be part of a great founding team. With this job, you are able to: * Work on the cutting edge of Web 2.0 development * Be part of a founding team of an exciting startup * Work with fun and innovative people who are just as passionate about the web as you are!! We do not look not for technical competency, but rather, you must possess a hunger to code, to succeed and be passionate. Just email me and I'll reply ASAP. :-) Have a nice weekend! Cheers, Michael --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: View (maybe middleware?) question
hmm, yeah, that's about what I am looking for (the site lang approach). I'll look into that some more. For this particular app, there are no stored user profiles (e.g. there is no logging in), so as much as I'd like to store this setting in a user profile, and requiring login, I can't guarantee that here. The primary view that will take advantage of this is a registration/ survey page that I want to have different themes on depending on the partner/ group that is directing users to the site. When someone registers, I need to track the theme as well, but it's more for the look and feel when the users visit the site. I can probably get away with restricting it to this particular app (in the middleware) and just create a list of common view urls that it should ignore when looking at the theme portion of the url, so as to avoid strange path catches. -Chris On May 31, 2:33 am, orestis <[EMAIL PROTECTED]> wrote: > I've done something similar to this, putting the site language in the > url. > > Basically you create a middleware process_request, that will take > request.path and set it to something else. > > For example you might do: > > request.path = "/app/theme/view/" > > parts = request.path.split("/") > > request.path = "/"+parts[0]+"/"+parts[2] > > theme = parts[1] > > #do something with the theme... > > return None > > Then your urlconfs will go on without knowing about the theme logic. > > Beware, though: This can lead to many strange errors when this catches > paths you don't want to be processed. You also have to worry about > search engines. It might be better to apply the same middleware to > extract something from the session/query parameters. > > On May 31, 1:23 am, Robert Coup <[EMAIL PROTECTED]> > wrote: > > > Chris Kelly wrote: > > > I am in the process of writing an app that will have a "theme" based > > > on if a subdirectory is specified e.g.: > > > >http://somesite.com/app/(theme)/abunchofviews/ > > > > basically, if they go to /app/bluetheme/register, it'll give them a > > > registration page with a blue theme header and footer (it looks up a > > > theme object based on the value specifed in the url, and gets header > > > images, etc from said object). Likewise, if "greentheme" is specified, > > > they would get a green-themed registration page. This way, someone can > > > later just go into the django admin section and create a new "theme" > > > by specifying a new header and footer image. > > > I know it doesn't answer your question, but search engines will see a > > different page for each different theme (eg. /red/mypage1 will be seen > > as a different page from /green/mypage1). > > > Maybe storing the theme in a user preference/session might be easier? A > > user could visit /theme/green/ to set the 'green' theme, then redirect > > to any of your normal application pages, which use the preference to > > decide . > > > Rob :) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: special session-time usecase
> I see what you are saying, but I want the user to be automatically > logged out after a period of inactivity for security purposes. Yes, this accomplishes that. > 1) Do you mean I would check the last time they saved and then > compare it with a time limit everytime they alter a session? Yes, basically, except that you're setting a session parameter on every page load, which is what you're checking against, rather than against the last time the user saved something. > 2) If the time limit has been surpassed, would I disallow the > transaction and then log them out? Yes. > I was hoping there was another way where somehow the system would > check constantly and expire old sessions and cookies automatically. > I'm still unsure how something could sit in the background and check > every minute, not sure if its even possible. Why would you need to actively cause them to expire, as long as they're refused when someone tries to accomplish something with them? If you log the user out upon any request after the expiration time, you get the same effect. The session becomes an expired session whether or not you delete the cookie, and whether or not the user ever returns to the site. Not sure if I'm explaining this clearly. In pseudo-code... on every request: if (session['last_activity'] > (now - 30min)): user.logout() session.destroy() session.create() session['last_activity'] = now redirect('/login_url') else: session['last_activity'] = now execute_requested_view() --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: special session-time usecase
I see what you are saying, but I want the user to be automatically logged out after a period of inactivity for security purposes. 1) Do you mean I would check the last time they saved and then compare it with a time limit everytime they alter a session? 2) If the time limit has been surpassed, would I disallow the transaction and then log them out? I was hoping there was another way where somehow the system would check constantly and expire old sessions and cookies automatically. I'm still unsure how something could sit in the background and check every minute, not sure if its even possible. On May 31, 12:07 pm, ringemup <[EMAIL PROTECTED]> wrote: > Why not store a parameter in the session indicating when it was last > saved. On each page load, first check that parameter and if it's too > long ago, discard the session and begin a new one. Then update the > parameter with the current time. > > You may need middleware to accomplish this, but it ought to be > extremely simple to implement. It won't get rid of the actual cookies > if the user doesn't return, but it will take care of session > expiration, and the old cookies shouldn't matter, since they contain > no session data except the ID, which you're invalidating after a > certain amount of time anyway. > > On May 31, 12:54 pm, tyman26 <[EMAIL PROTECTED]> wrote: > > > I also need to implement this type of feature. Did you find anything > > on this? > > > On May 2, 12:29 pm, [EMAIL PROTECTED] wrote: > > > > Hi all, > > > > I use django.contrib.sessionswith SESSION_EXPIRE_AT_BROWSER_CLOSE=True. > > > > I need a way toexpireasessionon certain amount of time of inactivity in > > > the browser. > > > > Each new request to django should retrigger theexpiretime. > > > > Is there a possibility to modifiy thesessionmodule or build a middleware > > > which does this ? > > > > Regards, > > > Dirk > > > -- > > > "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ... > > > Jetzt GMX TopMail testen:http://www.gmx.net/de/go/topmail --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ForeignKey to ForeignKey
I have 3 models, Shift, Person & Shiftmap. class Shift(models.Model): name = models.CharField() date = models.DateTimeField() class Person(models.Model): first_name = models.CharField() last_name = models.CharField() class Shiftmap(models.Model): shift = models.ForeignKey(Shift) person = models.ForeignKey(Person) This is a basic run down, not the actual models. You get the idea though. I want to use Person.shiftmap_set.all() but I want to sort it by Shiftmap.shift.date. Is this possible? Basically I need to use a Person object, to sort all Shifts assigned to it, via Shiftmap, sorted by Shift.date. Thanks! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Offline Django Apps
On May 31, 1:20 am, "Vagmi Mudumbai" <[EMAIL PROTECTED]> wrote: > Check out Google Gears.http://gears.google.com There's a lot of interesting things about Google Gears... It provides a browser local SQLite accessible via Javascript. It provides a local HTTP server for storing/retrieving cached content. Simon Willison dug up some interesting Google Gears tidbits: http://simonwillison.net/tags/googlegears/ including: Adobe's Apollo will use Google Gears technology, Dojo was in on the Google Gears collaboration uses it. Looks like a lot is happening in the world of offline web applications. Great stuff. -Rob --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Many-to-Many with quantities
Because of the dependants you might need to either manually add the tables to the db or if you don't have any values in that table delete all the rows in pizza and run syncdb again. Sometimes when working within the same class the syncdb doesn't change the database all the way (and rightly so). Give that a try and if it still doesn't work we'll try a different solution. On May 31, 1:03 pm, Gio <[EMAIL PROTECTED]> wrote: > Thanks to you all, I took something from all the replies and I wrote > this modifying Michael code: > > class Topping(models.Model): > name = models.CharField(maxlength=255, unique=True) > > def __str__(self): > return self.name > > class Admin: > pass > > class Pizza(models.Model): > name = models.CharField(maxlength=255, unique=True) > > def __str__(self): > return self.name > > class Admin: > pass > > class PizzaTopping(models.Model): > pizza = models.ForeignKey(Pizza, > help_text = 'Toppings to go on Pizza: > num in admin is how many will show up in Pizza', > edit_inline = models.TABULAR, > num_in_admin = 3, > core=True) > topping = models.ForeignKey(Topping) > amount = models.IntegerField() > > I got problems in admin: I inserted a few toppings, now when I insert > a new pizza with his toppings the toppings and quantities aren't > saved. > No error messages, but inspecting database reveals no entries for the > auxiliary table pizza_pizzatopping > > Any hint? > I'd like to solve this problem, leaving a solution for the archives. > > Thanks, > Giovanni. > > On 31 Mag, 18:27, Michael Newman <[EMAIL PROTECTED]> wrote: > > > Nis; > > Thanks for catching that I left the manytomany field there. There is > > no need for that. > > revised code: > > > class Topping(models.Model): > > # ... > > > class Pizza(models.Model): > > # ... > > > class PizzaToppings(model.Model): > > pizza = models.ForeignKey(Pizza, help_text='Toppings to go on > > Pizza: num in admin is how many will show up in Pizza', > > edit_inline=models.TABULAR, num_in_admin=3) > > topping = models.ManyToOne(Topping) > > amount = models.IntegerField() > > #... > > > This will appear in the Pizza part of the admin as a stacked model and > > allow you to use or add as many as you would like. So you can remove > > the amount if you just want people to be able to add double cheese by > > adding a second cheese topping. > > > Thanks Nis and good luck Giovanni. > > > Mn > > > On May 31, 12:21 pm, Nis Jorgensen <[EMAIL PROTECTED]> wrote: > > > > Gio wrote: > > > > Hi, > > > > I searched about this subject and found only a few very old posts, so > > > > maybe there is a better solution now. > > > > > As you may guess the model I'd like to code is similar to the Pizza - > > > > Toppings you know from the "Creating Models" documentation: > > > > > class Topping(models.Model): > > > > # ... > > > > > class Pizza(models.Model): > > > > # ... > > > > toppings = models.ManyToManyField(Topping) > > > > > And what if I need to say that I can have two or three times the same > > > > topping on my pizza? Something like twice mozzarella cheese and 3 > > > > times green olives topping? > > > > > I though about an intermediary class and indeed this is the same > > > > solution found in those old posts mentioned before: > > > > > class Topping(models.Model): > > > > # ... > > > > > class ToppingAndQuantity(models.Model): > > > > amount = models.IntegerField() > > > > topping = models.ForeignKey(Topping) > > > > > class Pizza(models.Model): > > > > # ... > > > > toppings = models.ManyToManyField(ToppingAndQuantity) > > > > > I think it's ugly. > > > > Can you suggest me a better solution? > > > > It's that intermediary class really needed? > > > > I believe you should have > > > > class Topping(models.Model): > > > # ... > > > > class Pizza(models.Model): > > > # ... > > > > class PizzaTopping(models.Model): > > > amount = models.IntegerField() > > > topping = models.ForeignKey(Topping) > > > pizza = models.ForeignKey(Pizza) > > > > The "PizzaTopping" class is really a more elaborate specification of the > > > many-to-many relationship, so you don't need the ManyToManyField > > > anymore. Your model has the problem that two pizzas can share > > > (Mozarella, 2) - leading to problems if you modify one of them. > > > > You will want to do the invocations for making (topping, pizza) unique > > > as well, and possibly do some magic so that trying to add another > > > Mozarella will increment the quantity instead. > > > > Disclaimers: I am a novice Django user. The code is untested. > > > > Update: Between posting and reposting from the correct mail address, I > > > saw the response from Michael. He is using "ManyToOneField" which I > > > don't see in my documentation, and keeps the
Re: special session-time usecase
Why not store a parameter in the session indicating when it was last saved. On each page load, first check that parameter and if it's too long ago, discard the session and begin a new one. Then update the parameter with the current time. You may need middleware to accomplish this, but it ought to be extremely simple to implement. It won't get rid of the actual cookies if the user doesn't return, but it will take care of session expiration, and the old cookies shouldn't matter, since they contain no session data except the ID, which you're invalidating after a certain amount of time anyway. On May 31, 12:54 pm, tyman26 <[EMAIL PROTECTED]> wrote: > I also need to implement this type of feature. Did you find anything > on this? > > On May 2, 12:29 pm, [EMAIL PROTECTED] wrote: > > > Hi all, > > > I use django.contrib.sessions with SESSION_EXPIRE_AT_BROWSER_CLOSE=True. > > > I need a way toexpireasessionon certain amount of time of inactivity in the > > browser. > > > Each new request to django should retrigger theexpiretime. > > > Is there a possibility to modifiy thesessionmodule or build a middleware > > which does this ? > > > Regards, > > Dirk > > -- > > "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ... > > Jetzt GMX TopMail testen:http://www.gmx.net/de/go/topmail --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Many-to-Many with quantities
Thanks to you all, I took something from all the replies and I wrote this modifying Michael code: class Topping(models.Model): name = models.CharField(maxlength=255, unique=True) def __str__(self): return self.name class Admin: pass class Pizza(models.Model): name = models.CharField(maxlength=255, unique=True) def __str__(self): return self.name class Admin: pass class PizzaTopping(models.Model): pizza = models.ForeignKey(Pizza, help_text = 'Toppings to go on Pizza: num in admin is how many will show up in Pizza', edit_inline = models.TABULAR, num_in_admin = 3, core=True) topping = models.ForeignKey(Topping) amount = models.IntegerField() I got problems in admin: I inserted a few toppings, now when I insert a new pizza with his toppings the toppings and quantities aren't saved. No error messages, but inspecting database reveals no entries for the auxiliary table pizza_pizzatopping Any hint? I'd like to solve this problem, leaving a solution for the archives. Thanks, Giovanni. On 31 Mag, 18:27, Michael Newman <[EMAIL PROTECTED]> wrote: > Nis; > Thanks for catching that I left the manytomany field there. There is > no need for that. > revised code: > > class Topping(models.Model): > # ... > > class Pizza(models.Model): > # ... > > class PizzaToppings(model.Model): > pizza = models.ForeignKey(Pizza, help_text='Toppings to go on > Pizza: num in admin is how many will show up in Pizza', > edit_inline=models.TABULAR, num_in_admin=3) > topping = models.ManyToOne(Topping) > amount = models.IntegerField() > #... > > This will appear in the Pizza part of the admin as a stacked model and > allow you to use or add as many as you would like. So you can remove > the amount if you just want people to be able to add double cheese by > adding a second cheese topping. > > Thanks Nis and good luck Giovanni. > > Mn > > On May 31, 12:21 pm, Nis Jorgensen <[EMAIL PROTECTED]> wrote: > > > Gio wrote: > > > Hi, > > > I searched about this subject and found only a few very old posts, so > > > maybe there is a better solution now. > > > > As you may guess the model I'd like to code is similar to the Pizza - > > > Toppings you know from the "Creating Models" documentation: > > > > class Topping(models.Model): > > > # ... > > > > class Pizza(models.Model): > > > # ... > > > toppings = models.ManyToManyField(Topping) > > > > And what if I need to say that I can have two or three times the same > > > topping on my pizza? Something like twice mozzarella cheese and 3 > > > times green olives topping? > > > > I though about an intermediary class and indeed this is the same > > > solution found in those old posts mentioned before: > > > > class Topping(models.Model): > > > # ... > > > > class ToppingAndQuantity(models.Model): > > > amount = models.IntegerField() > > > topping = models.ForeignKey(Topping) > > > > class Pizza(models.Model): > > > # ... > > > toppings = models.ManyToManyField(ToppingAndQuantity) > > > > I think it's ugly. > > > Can you suggest me a better solution? > > > It's that intermediary class really needed? > > > I believe you should have > > > class Topping(models.Model): > > # ... > > > class Pizza(models.Model): > > # ... > > > class PizzaTopping(models.Model): > > amount = models.IntegerField() > > topping = models.ForeignKey(Topping) > > pizza = models.ForeignKey(Pizza) > > > The "PizzaTopping" class is really a more elaborate specification of the > > many-to-many relationship, so you don't need the ManyToManyField > > anymore. Your model has the problem that two pizzas can share > > (Mozarella, 2) - leading to problems if you modify one of them. > > > You will want to do the invocations for making (topping, pizza) unique > > as well, and possibly do some magic so that trying to add another > > Mozarella will increment the quantity instead. > > > Disclaimers: I am a novice Django user. The code is untested. > > > Update: Between posting and reposting from the correct mail address, I > > saw the response from Michael. He is using "ManyToOneField" which I > > don't see in my documentation, and keeps the ManyToManyField(Topping) > > which seems strange to me. I believe you will be able to put together a > > good solution from the two posts. > > > Nis --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: special session-time usecase
I also need to implement this type of feature. Did you find anything on this? On May 2, 12:29 pm, [EMAIL PROTECTED] wrote: > Hi all, > > I use django.contrib.sessions with SESSION_EXPIRE_AT_BROWSER_CLOSE=True. > > I need a way toexpireasessionon certain amount of time of inactivity in the > browser. > > Each new request to django should retrigger theexpiretime. > > Is there a possibility to modifiy thesessionmodule or build a middleware > which does this ? > > Regards, > Dirk > -- > "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ... > Jetzt GMX TopMail testen:http://www.gmx.net/de/go/topmail --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Very large scale sites in Django
On Thursday 31 May 2007 11:44:51 Tim Chase wrote: > It would also be helpful to know things about the usage > patterns--particularly the read-to-write ratio and > currency-demands. > > If most of your hits are reads, and stale data is okay (only > updated every N minutes), then you're a top candidate for several > of the caching solutions supported by Django. Or even front-end > caches that prevent Django from even seeing the request. Fortunately most of the hits are reads and they don't need to return up-to-the-second data. Minutes, maybe. So it sounds like door number one will do for us. Currently we use Akami caching for the Drupal version of the site, but it's a very expensive way to go. I'll investigate caching solutions supported by Django. A quick glance at the memcached site says that it's used on LiveJournal, which gets over 20,000,000 page requests per day. Excellent. Not quite at our traffic level, but not too shabby. :) Thanks, Tim. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Many-to-Many with quantities
Nis; Thanks for catching that I left the manytomany field there. There is no need for that. revised code: class Topping(models.Model): # ... class Pizza(models.Model): # ... class PizzaToppings(model.Model): pizza = models.ForeignKey(Pizza, help_text='Toppings to go on Pizza: num in admin is how many will show up in Pizza', edit_inline=models.TABULAR, num_in_admin=3) topping = models.ManyToOne(Topping) amount = models.IntegerField() #... This will appear in the Pizza part of the admin as a stacked model and allow you to use or add as many as you would like. So you can remove the amount if you just want people to be able to add double cheese by adding a second cheese topping. Thanks Nis and good luck Giovanni. Mn On May 31, 12:21 pm, Nis Jorgensen <[EMAIL PROTECTED]> wrote: > Gio wrote: > > Hi, > > I searched about this subject and found only a few very old posts, so > > maybe there is a better solution now. > > > As you may guess the model I'd like to code is similar to the Pizza - > > Toppings you know from the "Creating Models" documentation: > > > class Topping(models.Model): > > # ... > > > class Pizza(models.Model): > > # ... > > toppings = models.ManyToManyField(Topping) > > > And what if I need to say that I can have two or three times the same > > topping on my pizza? Something like twice mozzarella cheese and 3 > > times green olives topping? > > > I though about an intermediary class and indeed this is the same > > solution found in those old posts mentioned before: > > > class Topping(models.Model): > > # ... > > > class ToppingAndQuantity(models.Model): > > amount = models.IntegerField() > > topping = models.ForeignKey(Topping) > > > class Pizza(models.Model): > > # ... > > toppings = models.ManyToManyField(ToppingAndQuantity) > > > I think it's ugly. > > Can you suggest me a better solution? > > It's that intermediary class really needed? > > I believe you should have > > class Topping(models.Model): > # ... > > class Pizza(models.Model): > # ... > > class PizzaTopping(models.Model): > amount = models.IntegerField() > topping = models.ForeignKey(Topping) > pizza = models.ForeignKey(Pizza) > > The "PizzaTopping" class is really a more elaborate specification of the > many-to-many relationship, so you don't need the ManyToManyField > anymore. Your model has the problem that two pizzas can share > (Mozarella, 2) - leading to problems if you modify one of them. > > You will want to do the invocations for making (topping, pizza) unique > as well, and possibly do some magic so that trying to add another > Mozarella will increment the quantity instead. > > Disclaimers: I am a novice Django user. The code is untested. > > Update: Between posting and reposting from the correct mail address, I > saw the response from Michael. He is using "ManyToOneField" which I > don't see in my documentation, and keeps the ManyToManyField(Topping) > which seems strange to me. I believe you will be able to put together a > good solution from the two posts. > > Nis --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Many-to-Many with quantities
> And what if I need to say that I can have two or three times the same > topping on my pizza? Something like twice mozzarella cheese and 3 > times green olives topping? > > I though about an intermediary class and indeed this is the same > solution found in those old posts mentioned before: > > class Topping(models.Model): > # ... > > class ToppingAndQuantity(models.Model): > amount = models.IntegerField() > topping = models.ForeignKey(Topping) > > class Pizza(models.Model): > # ... > toppings = models.ManyToManyField(ToppingAndQuantity) > > I think it's ugly. > Can you suggest me a better solution? > It's that intermediary class really needed? I believe this is the best way to do it. However, this generally gets composed as class Pizza(Model): #don't reference toppings here class ToppingAndQuantity(Model): pizza = ForeignKey(Pizza) topping = ForeignKey(Topping) amount = PositiveIntegerField() The information you want (the quantity) is associated with the join between a pizza and its toppings. The ManyToMany would make a situation where you could have one pizza that has both 2x Cheese and 4x Cheese. I suspect that you want just one topping per pizza, but a quantity associated with that one topping. The ManyToMany is a nice shortcut for basically creating this intermediate join model with only two FK fields in it (pizza and topping) with a little syntactic sugar around them. With the above, you should be able to do things somewhat like p = Pizza.objects.get(id=1) for topping in p.toppingandquantity_set: print "%s x%i" % (p.topping, p.amount) -tim --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Running tests - minor problem with fixtures
Well, just a follow up for future spelunkers to this list. Updating my code to the changes in 5173 and 5211 worked (it now loads fixtures that are not named initial_data.json). For some reason, straight code from 0.96 doesn't work, I never figured out why. And I patched get_sql_flush() to use "SELECT setval()" for my elderly version of Postgres, so all is well. Don --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Many-to-Many with quantities
Gio wrote: > Hi, > I searched about this subject and found only a few very old posts, so > maybe there is a better solution now. > > As you may guess the model I'd like to code is similar to the Pizza - > Toppings you know from the "Creating Models" documentation: > > class Topping(models.Model): > # ... > > class Pizza(models.Model): > # ... > toppings = models.ManyToManyField(Topping) > > > And what if I need to say that I can have two or three times the same > topping on my pizza? Something like twice mozzarella cheese and 3 > times green olives topping? > > I though about an intermediary class and indeed this is the same > solution found in those old posts mentioned before: > > class Topping(models.Model): > # ... > > class ToppingAndQuantity(models.Model): > amount = models.IntegerField() > topping = models.ForeignKey(Topping) > > class Pizza(models.Model): > # ... > toppings = models.ManyToManyField(ToppingAndQuantity) > > > I think it's ugly. > Can you suggest me a better solution? > It's that intermediary class really needed? > I believe you should have class Topping(models.Model): # ... class Pizza(models.Model): # ... class PizzaTopping(models.Model): amount = models.IntegerField() topping = models.ForeignKey(Topping) pizza = models.ForeignKey(Pizza) The "PizzaTopping" class is really a more elaborate specification of the many-to-many relationship, so you don't need the ManyToManyField anymore. Your model has the problem that two pizzas can share (Mozarella, 2) - leading to problems if you modify one of them. You will want to do the invocations for making (topping, pizza) unique as well, and possibly do some magic so that trying to add another Mozarella will increment the quantity instead. Disclaimers: I am a novice Django user. The code is untested. Update: Between posting and reposting from the correct mail address, I saw the response from Michael. He is using "ManyToOneField" which I don't see in my documentation, and keeps the ManyToManyField(Topping) which seems strange to me. I believe you will be able to put together a good solution from the two posts. Nis --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Many-to-Many with quantities
You could need an extra class for this but it should work: class Topping(models.Model): # ... class Pizza(models.Model): # ... toppings = models.ManyToManyField(Topping) class PizzaToppings(model.Model): pizza = models.ForeignKey(Pizza, help_text='Toppings to go on Pizza: num in admin is how many will show up in Pizza', edit_inline=models.TABULAR, num_in_admin=3) topping = models.ManyToOne(Topping) #... some related material: http://www.djangoproject.com/documentation/model-api/#many-to-one-relationships Hope that helps, Mn On May 31, 11:48 am, Gio <[EMAIL PROTECTED]> wrote: > Hi, > I searched about this subject and found only a few very old posts, so > maybe there is a better solution now. > > As you may guess the model I'd like to code is similar to the Pizza - > Toppings you know from the "Creating Models" documentation: > > class Topping(models.Model): > # ... > > class Pizza(models.Model): > # ... > toppings = models.ManyToManyField(Topping) > > And what if I need to say that I can have two or three times the same > topping on my pizza? Something like twice mozzarella cheese and 3 > times green olives topping? > > I though about an intermediary class and indeed this is the same > solution found in those old posts mentioned before: > > class Topping(models.Model): > # ... > > class ToppingAndQuantity(models.Model): > amount = models.IntegerField() > topping = models.ForeignKey(Topping) > > class Pizza(models.Model): > # ... > toppings = models.ManyToManyField(ToppingAndQuantity) > > I think it's ugly. > Can you suggest me a better solution? > It's that intermediary class really needed? > > Thank you, > Giovanni. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Very large scale sites in Django
>> AFAIK, the bottleneck tends to be the database, so a cache >> solution like memcached should make the deal. Think of a >> 256Mb cache for 10 seconds maybe. > > Yes, the database is generally the main bottleneck these days. > memcached is definitely on my radar. It would also be helpful to know things about the usage patterns--particularly the read-to-write ratio and currency-demands. If most of your hits are reads, and stale data is okay (only updated every N minutes), then you're a top candidate for several of the caching solutions supported by Django. Or even front-end caches that prevent Django from even seeing the request. If most of your hits are reads, but they need to have the most up-to-date info, you can use a replicated DB cluster where writes are synchronized lockstep across the cluster, and then a load-balancer farms out the reads across the cluster. Or, you can have as part of your writing (perhaps in a save() call), calls to your cache-controller to invalidate affected pages. If you're write-heavy, best wishes! ;-) Data partitioning may help, as might a multi-master DB configuration. -tim --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Many-to-Many with quantities
Hi, I searched about this subject and found only a few very old posts, so maybe there is a better solution now. As you may guess the model I'd like to code is similar to the Pizza - Toppings you know from the "Creating Models" documentation: class Topping(models.Model): # ... class Pizza(models.Model): # ... toppings = models.ManyToManyField(Topping) And what if I need to say that I can have two or three times the same topping on my pizza? Something like twice mozzarella cheese and 3 times green olives topping? I though about an intermediary class and indeed this is the same solution found in those old posts mentioned before: class Topping(models.Model): # ... class ToppingAndQuantity(models.Model): amount = models.IntegerField() topping = models.ForeignKey(Topping) class Pizza(models.Model): # ... toppings = models.ManyToManyField(ToppingAndQuantity) I think it's ugly. Can you suggest me a better solution? It's that intermediary class really needed? Thank you, Giovanni. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Stagnating Djangobook? Broken Atom feed?
On May 30, 9:29 am, Rob Hudson <[EMAIL PROTECTED]> wrote: > I was kind of wondering the same... is the Django Book going to align > with Django 1.0? If it's going to press in June as Apress currently claims, then I'm guessing "Pro Django" won't cover Django 1.0. Jacob? It is nice to see that it mentions Oracle, so I hope that means our branch will be merged before the book comes out... (I just bought the excellent "Programming Erlang" book from Pragmatic Programmers, and I wish there were a similar "get the PDF now, the dead tree version later" option for the Django Book.) We'll buy several copies when it is released. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Very large scale sites in Django
Daniel Ellison <[EMAIL PROTECTED]> writes: > On Thursday 31 May 2007 11:26:37 Nic James Ferrier wrote: >> Daniel Ellison <[EMAIL PROTECTED]> writes: >> > Sounds like this might end up being the highest-traffic Django site there >> > is! :) >> >> Errr... I might be in competition with you there. >> >> /8-> > > Fine. Sounds like this might end up being the second highest-traffic Django > site there is! :) > > What site do you run that gets > 400 hits per second, sustained? You could > definitely provide some sage advice! I might be in competition with you to end up being the highest-traffic django site there is. As to scaling advice... I've gone for the REST/quite-a-few-machines/partitioned-resource-space approach. This should mean that the machines we use are smaller than than normal (maybe even VMs) and so we can have more of them. We have yet to do scaling tests though. So I could still end up with egg on my face (mmm! egg!) -- Nic Ferrier http://www.tapsellferrier.co.uk --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Moving Images to Amazon S3
I think my question wasn't clear: we're having NO problem putting files on S3, that's dead simple (ie what Holovaty blogged about). What we need to do is take an *in-memory Image* and put it directly onto S3. We need a way to convert a PIL Image instance into a format S3 can accept WITHOUT having to first save the Image to the file- system. S3 accepts the kind of string that gets returned from open(afile).read() I was trying to wrap the result of img.tostring() in the StringIO class, and then put that on S3, but that doesn't work either... --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Very large scale sites in Django
On Thursday 31 May 2007 11:26:37 Nic James Ferrier wrote: > Daniel Ellison <[EMAIL PROTECTED]> writes: > > Sounds like this might end up being the highest-traffic Django site there > > is! :) > > Errr... I might be in competition with you there. > > /8-> Fine. Sounds like this might end up being the second highest-traffic Django site there is! :) What site do you run that gets > 400 hits per second, sustained? You could definitely provide some sage advice! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Very large scale sites in Django
Daniel Ellison <[EMAIL PROTECTED]> writes: > Sounds like this might end up being the highest-traffic Django site there > is! :) Errr... I might be in competition with you there. /8-> -- Nic Ferrier http://www.tapsellferrier.co.uk --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem with flatpages and absolute urls
OK never mind about this. It was my error, I was creating some URLs like this: /{{var}}/path1/path2/ and sometimes var wasn't set so the url becomes: //path1/path2/ which replaces everything in the browser... --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Very large scale sites in Django
On Thursday 31 May 2007 10:31:24 John M wrote: > I would love to know your site. Well, I'll reveal that when the site launches, but suffice to say it's for a very popular network TV show. We did the current site and are now redesigning and rearchitecting the entire thing for the next season. Don't worry though, I'll almost certainly have many questions during the course of its development. We already successfully launched a Django-powered site for another TV show, but the traffic isn't in the same league. Does anyone have hints regarding migrating a Drupal site to Django? I would appreciate any pointers people might have. Sounds like this might end up being the highest-traffic Django site there is! :) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Very large scale sites in Django
On Thursday 31 May 2007 09:03:32 Christian Markwart Hoeppner wrote: > AFAIK, the bottleneck tends to be the database, so a cache solution like > memcached should make the deal. Think of a 256Mb cache for 10 seconds > maybe. Yes, the database is generally the main bottleneck these days. memcached is definitely on my radar. > Of course, the hardware should be able at least to serve that amount of > static pages, and maybe you should think about running the database on > another box, and link them with a proper lan. Currently we have three web server machines behind a load balancer, all of which talk to one MySQL database on another machine. We also have a separate machine for the copious media involved. Of course, the load is mitigated by the (expensive!) Akami off-site caching. > Though I have not ever experienced such a traffic, so this is pure > theory. Thanks for the response! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problem with flatpages and absolute urls
I have a problem with flatpages. When putting links in my templates, I use absolute URLs without prepending http://hostname.com/ For example, Home gets interpreted by the browser as a link to http://hostname.com/, and all is correct. However, when a flatpage is being served, those links get interpreted literally, so the link now is http:/// which is of course useless. I suspect this is something to do with the 404 response that triggers something in firefox. So what am I supposed to do ? Should I prepend everything with the hostname ? How can I get the current site (so I won't couple the template to the site) ? Thanks --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Checking group permissions in template code
After reading the docs and looking for posts relating this problem here and in .developers, I found no "standard" way of checking for a user's group permissions in the templates. So what I did is to add the following method to auth.models.User (yeah, yeah, it *should* be in appname.models.UserProfile): def group_permissions(self): class GroupPermissions: def __init__(self, permissions): for perm in permissions: setattr(self, perm, True) def __str__(self): return 'The user belongs to the following groups: %s' % \ ', '.join([k for k, v in self.__dict__.iteritems()]) return GroupPermissions(self.get_group_permissions()) which lets me write something like the following in my templates: {% if user.group_permissions.permission_name %} draw custom menues for this particular group here {% endif %} So, is there already a way to do this and I missed it? If not, given that it is apparently not advisable (is it?) to extend the auth.models.User class, how about we add it? -Facundo. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Very large scale sites in Django
I would love to know your site. On May 31, 5:26 am, Daniel Ellison <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm about to start a Django project that will be replacing an existing > high-profile Drupal site. The existing site has extremely high traffic - > approximately 1,440,000 page views per hour, or 400 per second. This is only > possible with the help of Akami. Without Akami the site would melt. > > Is there anything I need to be aware of with regard to Django and high > availability? I saw this: > > http://www.davidcramer.net/other/43/rapid-development-serving-50-... > > but our traffic is triple that. I did glean a lot of good information from the > site, however. > > I know that if we throw enough hardware at the system it will be able to > handle the volume, but we don't have the budget for the hardware necessary in > this case. Does anyone have any experience with a site of this magnitude? The > 400 pages per second is a constant rate, not peak. > > The launch date is in September, so we have a limited time to design the > models, port over the data (from Drupal's fractured database structure), and > recreate this site from scratch. > > Thanks! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newforms / Validation / Uniqueness
> Since full model-aware validation doesn't exist yet, example code would > be premature. :-) Ah, sorry, I thought you were saying that models have an existing validate() method that could be called on an object constructed by a form. On May 30, 3:18 pm, "Alfonso Ali" <[EMAIL PROTECTED]> wrote: > My solution is to use the base class parameter of form_for_[model|instance] > function, for example: Thanks, that looks like a reasonably elegant solution. I'm still trying to figure out what methods I'd need to override and whether they need to be completely rewritten or where I can call super(). If I get this working, I'm going to write up an "extending newforms for dummies" explanation in case there are other people out there who are as dense as me. ;-) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
django-tagging: TypeError: __init__() got an unexpected keyword argument 'form_class'
I'm trying to use django-tagging in my application but when I generate a form with "form_for_model" from a model which contains a TagField I get this error message: TypeError at /bookmarks/add/ __init__() got an unexpected keyword argument 'form_class' Request Method: GET Request URL:http://localhost:8080/bookmarks/add/ Exception Type: TypeError Exception Value:__init__() got an unexpected keyword argument 'form_class' Exception Location: /usr/lib/python2.5/site-packages/django/newforms/ fields.py in __init__, line 92 Traceback: /usr/lib/python2.5/site-packages/django/core/handlers/base.py in get_response 77. response = callback(request, *callback_args, **callback_kwargs) /usr/lib/python2.5/site-packages/django/newforms/models.py in form_for_model 73. formfield = formfield_callback(f) /usr/lib/python2.5/site-packages/django/newforms/models.py in 58. def form_for_model(model, form=BaseForm, formfield_callback=lambda f: f.formfield()): /usr/lib/python2.5/site-packages/django/db/models/fields/__init__.py in formfield 429. return forms.CharField(**defaults) /usr/lib/python2.5/site-packages/django/newforms/fields.py in __init__ 92. super(CharField, self).__init__(*args, **kwargs) models.py: class Bookmark(models.Model): title = models.CharField(maxlength=255) url = models.URLField(verify_exists=True) description = models.TextField(blank=True) owner = models.ForeignKey(User) tags = TagField() urls.py: bookmark_list = { 'queryset' : Bookmark.objects.all(), 'allow_empty': True, } urlpatterns = patterns('', (r'^$', list_detail.object_list, bookmark_list), (r'^add/$', bookmark_add), ) views.py: def bookmark_add(request): BookmarkForm = forms.models.form_for_model(Bookmark) form = BookmarkForm() template = "bookmarks/bookmark_add.html" context = { 'form': form, } return render_to_response(template, context) It works to add bookmarks with tags from within the admin panel. Python version: 2.5.1 Django version: 0.96 django-tagging version: 0.1 I'm sure I have missed something fundamental since I'm new to Django, but if someone could guide me to some documentation or explain the error I would be grateful. Thanks! Erik Nordlund --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problems with nesh thumbnails and whitespaces
You mean White Space in the url of the image? On May 31, 6:42 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 31-May-07, at 4:05 PM, Alessandro Ronchi wrote: > > > I am using ImageWithThumbnailField from nesh utils. if I upload a file > > with a white > > space it doens't work, and the file name is thumbnail-none.jpg > > ahh - thanks for that tip, some of my sites people were complaining > that they were getting this none.jpg thing and i couldnt replicate > the error and they were thinking that I am an idiot and i was > thinking that they were idiots. White space. > > -- > > regards > kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: multilanguage site
Hi, On Thu, 31 May 2007 04:04:58 -0700, Grupo Django wrote: > If someone tell me what documents should I look to modify the django > code, I'll try to do it, and propose it. > I built a complete multilingual system for a PHP framework in just a > few hours. Achtually, you do not need to modify *anything* inside of Django. You just implement it separately and maybe it gets included in django.contrib. You should take a look at http://www.djangoproject.com/documentation/contributing/ regards, Marek --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Unexpected keyword argument 'runner' when running unit tests
On 5/30/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > On 5/30/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > > I'll add something suitably informative when I get a chance. > > It's my mess - I'll clean it up. Ticket #4426 for future reference. FYI - Fixed in [5391] Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Very large scale sites in Django
Hi there, AFAIK, the bottleneck tends to be the database, so a cache solution like memcached should make the deal. Think of a 256Mb cache for 10 seconds maybe. Of course, the hardware should be able at least to serve that amount of static pages, and maybe you should think about running the database on another box, and link them with a proper lan. Though I have not ever experienced such a traffic, so this is pure theory. Kind regards, Chris Hoeppner www.pixware.org El jue, 31-05-2007 a las 08:26 -0400, Daniel Ellison escribi�: > Hi all, > > I'm about to start a Django project that will be replacing an existing > high-profile Drupal site. The existing site has extremely high traffic - > approximately 1,440,000 page views per hour, or 400 per second. This is only > possible with the help of Akami. Without Akami the site would melt. > > Is there anything I need to be aware of with regard to Django and high > availability? I saw this: > > http://www.davidcramer.net/other/43/rapid-development-serving-50-pageshour.html > > but our traffic is triple that. I did glean a lot of good information from > the > site, however. > > I know that if we throw enough hardware at the system it will be able to > handle the volume, but we don't have the budget for the hardware necessary in > this case. Does anyone have any experience with a site of this magnitude? The > 400 pages per second is a constant rate, not peak. > > The launch date is in September, so we have a limited time to design the > models, port over the data (from Drupal's fractured database structure), and > recreate this site from scratch. > > Thanks! > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Very large scale sites in Django
Hi all, I'm about to start a Django project that will be replacing an existing high-profile Drupal site. The existing site has extremely high traffic - approximately 1,440,000 page views per hour, or 400 per second. This is only possible with the help of Akami. Without Akami the site would melt. Is there anything I need to be aware of with regard to Django and high availability? I saw this: http://www.davidcramer.net/other/43/rapid-development-serving-50-pageshour.html but our traffic is triple that. I did glean a lot of good information from the site, however. I know that if we throw enough hardware at the system it will be able to handle the volume, but we don't have the budget for the hardware necessary in this case. Does anyone have any experience with a site of this magnitude? The 400 pages per second is a constant rate, not peak. The launch date is in September, so we have a limited time to design the models, port over the data (from Drupal's fractured database structure), and recreate this site from scratch. Thanks! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: multilanguage site
Grupo Django napisał(a): > Can you please provide me some document where I can find some > information and examples? This is how this all gettext machinery works. It doesn't matter where in the sources the key is located, if gettext finds the key, it will replace it with its translated value or use the key if the translation is missing. The act of translation is unavoidable, so it doesn't matter if you use database table with translations, or use gettext machinery and translate the PO files, but it the gettext has ready-made infrastructure in Django and you don't have to do anything special to get your texts translated, providing you have done the translation. ;) You can add the keys by just extracting the texts from database table, then placing it in PO file (i.e. using some script). The PO file format is simple and you'll find the description in any introductory text for gettext, i.e. in http://www.gnu.org/software/gettext/manual/gettext.html -- Jarek Zgoda "We read Knuth so you don't have to." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Guido like Django
Many people know that Guido like django, that's right! Today Google Developer Day is held in Beijing, and Guido also made a python introduction. In his talk he said at least 4 times that he likes Django. And I'm very excited about this. And I think maybe it's a great opportunity for Django development in China, and I hope more and more people would like to learn Django from now. -- I like python! UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad My Blog: http://www.donews.net/limodou --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Applications imports best practices ?
> 2. import bar.module > the application is more portable, but its path has to be included in > PYTHON_PATH (at least under mod_python) A simpler variation of this is, "put it in your PYTHON_PATH". Personally, I have found this the easiest way to both maintain apps and deploy them. -- -Ben --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: multilanguage site
Can you please provide me some document where I can find some information and examples? Thank you. On 31 mayo, 12:11, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Grupo Django napisał(a): > > > Hello, I'm going to start a new multilingual site. I think that the > > django tools are very powerful for this purpose, but I need a bit > > more. > > I have to translate the content from the database and I have a few > > options: > > The simplest thing that comes to my mind is to create dummy python > module with the database content marked for translation. I saw this > approach for the first time in QuodLibet sources, then we implemented it > in our applications and it works fine. > > -- > Jarek Zgoda > > "We read Knuth so you don't have to." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: multilanguage site
> > - Could it be implemented in futures django releases? > > I think something like this could go in django.contrib. But I'm not sure > how many people need this. IMHO I think it's quite useful and it would be a great improvement. Django is so good that it's possible to use it for very professional sites, and those sites need generally content in several languages. Moreover, it's not very difficult to implement it in the way I exposed, and the text in the main language it's still stored in the original table, not in the translation one, so it's backwards compatible. Perhaps for the English speakers it's not especially necessary but for the rest of the world, we need to use our native language and English in our sites very often. If someone tell me what documents should I look to modify the django code, I'll try to do it, and propose it. I built a complete multilingual system for a PHP framework in just a few hours. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
a lot of information in http://www.real-article.com/
a lot of information in http://www.real-article.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problems with nesh thumbnails and whitespaces
On 31-May-07, at 4:05 PM, Alessandro Ronchi wrote: > I am using ImageWithThumbnailField from nesh utils. if I upload a file > with a white > space it doens't work, and the file name is thumbnail-none.jpg ahh - thanks for that tip, some of my sites people were complaining that they were getting this none.jpg thing and i couldnt replicate the error and they were thinking that I am an idiot and i was thinking that they were idiots. White space. -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problems with nesh thumbnails and whitespaces
I am using ImageWithThumbnailField from nesh utils. if I upload a file with a white space it doens't work, and the file name is thumbnail-none.jpg How can I solve this problem? Maybe I can change the name before creating the field and after uploading the file in the admin? -- Alessandro Ronchi Skype: aronchi - Wengo: aleronchi http://www.alessandroronchi.net - Il mio sito personale http://www.soasi.com - Sviluppo Software e Sistemi Open Source --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Moving Images to Amazon S3
"=?ISO-8859-1?Q?Fr=E9d=E9ric_Sidler?=" <[EMAIL PROTECTED]> writes: > openfount provide something that does the trick > http://www.openfount.com/blog/s3dfs-for-ec2 > > and adrian holovaty did something like that some weeks ago for > chicagocrime.org > http://www.holovaty.com/blog/archive/2006/04/07/0927 Yes. Implementing S3 at this level actually is not terribly hard... it works quite well. And there are good Python bindings for FUSE. -- Nic Ferrier http://www.tapsellferrier.co.uk --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Moving Images to Amazon S3
openfount provide something that does the trick http://www.openfount.com/blog/s3dfs-for-ec2 and adrian holovaty did something like that some weeks ago for chicagocrime.org http://www.holovaty.com/blog/archive/2006/04/07/0927 2007/5/31, Nic James Ferrier <[EMAIL PROTECTED]>: > > > Kyle Fox <[EMAIL PROTECTED]> writes: > > > The S3 API requires the file data to be in the format the > > open(myfile).read() returns (whatever that is). > > > > Is there a way to get the same data from an in-memory Image instance, > > so I don't need to save/re-read/delete each thumbnail file? > > Surely the better way to do this is to just use FUSE or something to > map S3 into the filesystem? > > > -- > Nic Ferrier > http://www.tapsellferrier.co.uk > > > > -- http://farm1.static.flickr.com/233/514575183_851b07d59b.jpg; alt="me" style="padding: 2px 6px 0pt 0pt; float: left;"> Frdric Sidler: Test at Mixin.com - http://www.mixin.com/; style="border-bottom: 1px dotted rgb(153, 153, 153); color: rgb(51, 153, 153); text-decoration: none;">Mixin.com contact | mailto:[EMAIL PROTECTED]" style="border-bottom: 1px dotted rgb(153, 153, 153); color: rgb(51, 153, 153); text-decoration: none;">[EMAIL PROTECTED] - +41 79 704 56 42 | mixin - frederic.sidler --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: multilanguage site
Grupo Django napisał(a): > Hello, I'm going to start a new multilingual site. I think that the > django tools are very powerful for this purpose, but I need a bit > more. > I have to translate the content from the database and I have a few > options: The simplest thing that comes to my mind is to create dummy python module with the database content marked for translation. I saw this approach for the first time in QuodLibet sources, then we implemented it in our applications and it works fine. -- Jarek Zgoda "We read Knuth so you don't have to." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Broken pipes with HttpResponseRedirect and Firefox / Trouble in paradise
Hello everyone We're having a similar issue, still trying to debug it now. We don't have a form on the page where the issue is, but there is a slight difference in error message. We get the same as Jon but hsi line is also in there. File "/usr/local/lib/python2.5/site-packages/django/core/servers/ basehttp.py", line 373, in send_preamble 'Date: %s\r\n' % time.asctime(time.gmtime(time.time())) If anyonw could shed some light on this it would make my day. I'll post up any solutions I may find, with a bit of luck. Out of interest, we found this issue by running ab against the web site. It was failing on some pages using -c10 and -n10 after the first request. Concurrency Level: 10 Time taken for tests: 0.044 seconds Complete requests: 10 Failed requests:9 (Connect: 2, Length: 7, Exceptions: 0) Broken pipe errors: 0 Total transferred: 72359 bytes HTML transferred: 71099 bytes Requests per second:227.27 [#/sec] (mean) Time per request: 44.00 [ms] (mean) Time per request: 4.40 [ms] (mean, across all concurrent requests) Transfer rate: 1644.52 [Kbytes/sec] received On May 26, 9:24 am, Steve Freitas <[EMAIL PROTECTED]> wrote: > On Fri, 2007-05-18 at 14:27 -0700, Jon Lesser wrote: > > I tool Malcolm's advice and looked closely at the packets going back > > and forth. Upon pressing an input button nested within an anchor, > > Firefox was sending two identical requests to the server, thus causing > > my code to be executed twice. It seems that after the server responded > > to one of the requests, the socket was closed and the second request > > threw a broken pipe exception. > > FWIW, I experienced this also when testing a site I was developing with > another framework, but I never looked into it enough to confirm that it > was Firefox's fault, but I did know IE didn't do it. Perhaps you could > file a bug against Firefox? > > Steve --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: multilanguage site
Hi, On Thu, 31 May 2007 01:30:31 -0700, Grupo Django wrote: > - Does anyone know a better solution for doing it? Use django-multilingual or django-utils (nesh.translation). Yesterday I started my own translation system which works like nesh.translation. > - Could it be implemented in futures django releases? I think something like this could go in django.contrib. But I'm not sure how many people need this. Anyway, there already is some i18n system in Django. Of course, it does not work well with content from the database. regards, Marek --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Moving Images to Amazon S3
Kyle Fox <[EMAIL PROTECTED]> writes: > The S3 API requires the file data to be in the format the > open(myfile).read() returns (whatever that is). > > Is there a way to get the same data from an in-memory Image instance, > so I don't need to save/re-read/delete each thumbnail file? Surely the better way to do this is to just use FUSE or something to map S3 into the filesystem? -- Nic Ferrier http://www.tapsellferrier.co.uk --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Where did you put your homepage view?
2007/5/30, Panos Laganakos <[EMAIL PROTECTED]>: > > direct_to_template sounds like a nice way to handle the index page > serving. > > But how can it be fed the dynamic content of one or more apps to > display? Not sure how it's supposed to be done > through "template tags" as Michel mentioned. You can do this with inclusion_tags: http://www.djangoproject.com/documentation/templates_python/#inclusion-tags Really useful. > > On May 24, 5:42 pm, Michel Thadeu Sabchuk <[EMAIL PROTECTED]> wrote: > > Index page doesn't need a view. Generally it is a static page, if it > > have some dynamic data, it access through template tags. So, I follow > > this structure: > > > > project/ > > project/templates/ > > project/templates/main/ > > project/templates/main/base.html > > project/templates/main/index.html > > project/templates/appname/another_template.html > > > > To point to the index template, I use generic views > > (direct_to_template). > > Best regards, > > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Migrate data between computers
> to migrate i do this: > 1. all code is anyway on svn, so i do a checkout in the new machine > 2. i do a pg_dump on the old machine, and after setting up the > database run: > psql -f dumpfile newdatabase Unfortunately, I have different versions of PostgreSQL database on my local enviroment and server. Therefore, output of pg_dump I must manually edit and this take me longer time, than dumpdata & syncdb & sqlflush & loaddata. > 3. manaully copy and edit settings.py (this is not under svn) > 4. use scp -r to copy the media stuff Hm, -r parameter? New to me, thank you for hint! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Migrate data between computers
> Are you overriding save() in any of your models (in particular, > anything querying StaticPage model? Yes, I am. I have there some check code, which prevent to save object, which will refer to itself. > The only workaround I know of for this is to do your dump in stages, > so that the data required by the query in the save() method is > available at the time the saved object. However, this approach isn't > always possible (depending on the circular relationships in your > data). I trust to my data, so I temporary disabled save() overriding. Now loaddata was successfull, and my application on computer2 works like charm. Thank you very much for advise. Regards Michal --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
multilanguage site
Hello, I'm going to start a new multilingual site. I think that the django tools are very powerful for this purpose, but I need a bit more. I have to translate the content from the database and I have a few options: - Translate it using the standard way, I mean, using po files. Problems: Every time I add/modify something to the database, I have to do the same in the po file, the right way is do everything in the admin zone. - Create some tables for the translation. I have built some multilanguage sites using PHP, and in the admin zone we had a select combo box with the available languages, if you change the language in the select, the fields with translation enabled, changed. I'm thinking about creating a model for the languages with 3 fields: *id *language code (ISO 639) * language name an other model for the translation strings: * id * table * field * id_row * string In the translation table, I'll have translations for the strings that require translation in other models.ie: | id | table | field | id_row | string| = |1 | 'polls' | 'question' | 34| 'Do you like this translation method?' And then implement it within the admin zone, wich is the main problem to me because I don't feel confident yet for manipulating the admin code and if I did, I'd have a lot of problems with the updates. - Does anyone know a better solution for doing it? - Could it be implemented in futures django releases? I really like to help but I have only made one web using django, and I'm still a newbie with a lot of questions, --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Migrate data between computers
On 31-May-07, at 1:39 PM, Michal wrote: > I would like migrate data from my Django project on notebook > (computer1) > to another machine (computer2). To perform this, I follow this steps: to migrate i do this: 1. all code is anyway on svn, so i do a checkout in the new machine 2. i do a pg_dump on the old machine, and after setting up the database run: psql -f dumpfile newdatabase 3. manaully copy and edit settings.py (this is not under svn) 4. use scp -r to copy the media stuff -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Offline Django Apps
Check out Google Gears. http://gears.google.com On 5/30/07, Tom <[EMAIL PROTECTED]> wrote: > > > > > On May 23, 2:51 am, Robert Coup <[EMAIL PROTECTED]> > wrote: > > Rob Hudson wrote: > > > Cool. What's the best way to coordinate the effort? A wiki page to > > > start with? > > > > Current trends seem to be to use Google Code for projects that aren't > > likely to become part of the core django distro. A link from the Django > > wiki is probably a good idea though. > > I've created a google code project - http://code.google.com/p/djangokit/ > - anyone who cares is welcome to membership. > > tom > > > > > -- http://installneo.blogspot.com "Peace is its own reward." - Mahatma Gandhi --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Migrate data between computers
On 5/31/07, Michal <[EMAIL PROTECTED]> wrote: > > Hello, > I would like migrate data from my Django project on notebook (computer1) > to another machine (computer2). To perform this, I follow this steps: > ... > Is this approach correct? Looks correct to me. > I ask you for this, because I have problem to load data on computer2. My > effort ends with error message: > >[EMAIL PROTECTED] app $./manage.py loaddata all.json >Loading 'all' fixtures... >Installing json fixture 'all' from absolute path. >Problem installing fixture 'all.json': StaticPage matching query does > not exist. I have seen this error before. That time, it wasn't (technically) due to a fault in the serializer - it was caused by a model overriding the save() method. In the overridden save() method, there a query was performed on the database, but the required objects had not yet been loaded. Are you overriding save() in any of your models (in particular, anything querying StaticPage model? The only workaround I know of for this is to do your dump in stages, so that the data required by the query in the save() method is available at the time the saved object. However, this approach isn't always possible (depending on the circular relationships in your data). Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Migrate data between computers
Hello, I would like migrate data from my Django project on notebook (computer1) to another machine (computer2). To perform this, I follow this steps: 1) On computer1 I call ./manage.py dumpdata > all.json 2) On computer2 I setup exactly same version of my Django project. Next I call ./manage.py syncdb which create all necessary DB tables and (unfortunately for me) all fixtures+initial data (like auth_permission, django_site, admin user, etc). 3) Because all.json file contains all data from computer1, I call ./manage.py sqlflush on computer2. This give me SQL statements, which I used to "clear" all data from fresh database on computer2. 4) Now I could call ./manage.py loaddata ./all.json Is this approach correct? I ask you for this, because I have problem to load data on computer2. My effort ends with error message: [EMAIL PROTECTED] app $./manage.py loaddata all.json Loading 'all' fixtures... Installing json fixture 'all' from absolute path. Problem installing fixture 'all.json': StaticPage matching query does not exist. I don't know what I should do now. Even, if I set --verbosity 2 to ./manage.py I don't get any usefull information what is wrong. Is it possible to found somehow where is the problem? Note: I used unicode branch [5387] on both computers, but I supposse, that this is some general problem Regards Michal --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: View (maybe middleware?) question
I've done something similar to this, putting the site language in the url. Basically you create a middleware process_request, that will take request.path and set it to something else. For example you might do: request.path = "/app/theme/view/" parts = request.path.split("/") request.path = "/"+parts[0]+"/"+parts[2] theme = parts[1] #do something with the theme... return None Then your urlconfs will go on without knowing about the theme logic. Beware, though: This can lead to many strange errors when this catches paths you don't want to be processed. You also have to worry about search engines. It might be better to apply the same middleware to extract something from the session/query parameters. On May 31, 1:23 am, Robert Coup <[EMAIL PROTECTED]> wrote: > Chris Kelly wrote: > > I am in the process of writing an app that will have a "theme" based > > on if a subdirectory is specified e.g.: > > >http://somesite.com/app/(theme)/abunchofviews/ > > > basically, if they go to /app/bluetheme/register, it'll give them a > > registration page with a blue theme header and footer (it looks up a > > theme object based on the value specifed in the url, and gets header > > images, etc from said object). Likewise, if "greentheme" is specified, > > they would get a green-themed registration page. This way, someone can > > later just go into the django admin section and create a new "theme" > > by specifying a new header and footer image. > > I know it doesn't answer your question, but search engines will see a > different page for each different theme (eg. /red/mypage1 will be seen > as a different page from /green/mypage1). > > Maybe storing the theme in a user preference/session might be easier? A > user could visit /theme/green/ to set the 'green' theme, then redirect > to any of your normal application pages, which use the preference to > decide . > > Rob :) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Moving Images to Amazon S3
I'm absolutely stuck on this. This question might be more python than django related, but I figured because it deals with Amazon S3, someone here may know how to handle it. Here's what needs to happen: 1. A user uploads an image (part of a Model we have) 2. Create a 100x100 thumbnail using PIL 3. Move the thumbnail to Amazon S3 Step 3 is the tricky part for me. I can't figure out how to do it, other than first temporarily saving the in-memory thumbnail to the filesystem, re-reading the file, moving the raw data to S3, and then deleting the temporary thumbnail file: # thumb is an already thumbnailed Image instance, in memory thumb.save( temp_path, "JPEG") raw = open( temp_path ).read() # code to move 'raw' to S3 os.remove( temp_path ) This is a pretty heavy way of doing it, and I'm desperate to find a better way of doing it but am absolutely out of ideas... The S3 API requires the file data to be in the format the open(myfile).read() returns (whatever that is). Is there a way to get the same data from an in-memory Image instance, so I don't need to save/re-read/delete each thumbnail file? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---