Re: ORM and case study

2006-12-07 Thread Kenneth Gonsalves
On 08-Dec-06, at 6:43 AM, coulix wrote: > If create tables without django model classes i guess i wont be > able to > use ORM on it right ? create the tables with django model classes - only populating the tables will be done directly and not through django -- regards kg

ORM and case study

2006-12-07 Thread coulix
Hello guys, i got an intern ship job in a trading company for summer. They have several servers, and plenty of logs with transactions id and states. My job is to parse all these stuffs get the timings of the states and build an interface to search look at specific transaction. The log are huge

Re: Optimizing Templates

2006-12-07 Thread John Lenton
On 12/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Well it's none of that. The template process time is literally > 150-500ms using the profiling stuff... me myself, I'd split that huge template into a hierarchy, and profile each chunk separately. That might give you a better clue as

Re: HTTP PUT and DELETE with Django?

2006-12-07 Thread yi huang
> > Is it possible to process HTTP PUT and DELETE requests with Django? If > so, how would I access the data uploaded in an HTTP PUT? > > (I would like to build a RESTful interface to some Django models. I > guess I can use POST to upload if I have to, but would like to try > using PUT if

Re: test client - Keeps returning 301 status code and not sure why.

2006-12-07 Thread Russell Keith-Magee
On 12/7/06, MerMer <[EMAIL PROTECTED]> wrote: Ok... First off - Russell wakes up and realizes the mistake he made. Note to self - don't answer email with an unhappy 7 month old in your lap. :-) I'm not sure which dark corner of my brain 'c.response' came from, but it was a bad suggestion - that

Re: TIME_ZONE? LocalTimezone? Help!!!

2006-12-07 Thread Todd O'Bryan
Whoops!!! I figured out what I was doing wrong. In settings.py, I had TIME_ZONE = 'America/New York' Notice the space (which should be an underscore) in the middle of New York. Terribly confused, my system just decided to leave me in UTC for my own good. Pretty darned confusing, let me tell

Re: filter by related record

2006-12-07 Thread Russell Keith-Magee
On 12/8/06, Rory Campbell-Lange <[EMAIL PROTECTED]> wrote: > > I'm not sure how to do a join against a related record: What you are looking for is: g = SiteEnergy.objects.filter(siteyear=9, typer__isoffsite=False) To explain why, lets look at your errors: >

Auto generate url patterns

2006-12-07 Thread leanmeandonothingmachine
Noob question: I've just started getting into django, and wanted to get opinions on auto generating url patterns from a db. Is that bad practice, will it slow down the site? I'm thinking of doing this for a few reasons: 1) The client is very particular about the path. So I want to use one app

Re: Singleton model instance

2006-12-07 Thread spacedman
My slightly graceless method is to override .save and .delete: http://groups.google.com/group/django-developers/browse_frm/thread/2caa976249783fae/# Then whatever model you define, it can only ever have one row (well, it will have zero rows before you put anything it). Barry

Re: TIME_ZONE? LocalTimezone? Help!!!

2006-12-07 Thread Todd O'Bryan
On Thu, 2006-12-07 at 16:06 -0600, Jacob Kaplan-Moss wrote: > On 12/7/06 3:41 PM, Todd O'Bryan wrote: > > OK. I've read the Python docs on tzinfo objects and I think I could make > > a tzinfo object, but it seems like there should be a way to get one out > > of the Django innards. > > > > I

Re: displaying thumbnails in admin

2006-12-07 Thread [EMAIL PROTECTED]
true, worst idea becouse i need sometimes only quick view what's going on. If i need real thumbnail, i can do something like this: def picture(self): if no file called self.filename_admin_thumb: create_the_thumb() return ''

Validation Summary

2006-12-07 Thread Brian Morton
I can't figure out how to make a validation summary on a form. I have examined the code in forms\__init__.py, and it reveals nothing about where the complete list of field/error pairs are stored. I would like to do a for loop on that dictionary and output a validation summary, then mark

Re: displaying thumbnails in admin

2006-12-07 Thread nymbyl
I'm thinking he said it was the worst idea because it just uses the img tag width and height to shrink the image - but the admin view would still have to load the images at actual size. For actual thumbnails, where the image that is loaded is actually smaller here are some ideas:

TIME_ZONE? LocalTimezone? Help!!!

2006-12-07 Thread Todd O'Bryan
OK. I've read the Python docs on tzinfo objects and I think I could make a tzinfo object, but it seems like there should be a way to get one out of the Django innards. I assume one can use the django.utils.tzinfo.LocalTimezone class to create a tzinfo object, but what the heck do you pass to the

Re: Session problems

2006-12-07 Thread Jakub Labath
Solved! Of course It was my code that was causing it! Python, apache, django (old or new version) mod_python, fastcgi are all innocent. What was it? RESPONSE_OBJECT = None def my_view(request): ...blah.. global REPOSNE_OBJECT if not RESPONSE_OBJECT: RESPONSE_OBJECT = HttpResponse()

Re: Optimizing Templates

2006-12-07 Thread Jeremy Dunck
On 12/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Good luck, here's one page's set: IIRC, you're doing -lots- of hits on these pages. Assuming you're already caching results where you can (in memcache or http downstream), you probably need to look at caching loaded templates. I'm

Sitemap questions (probably dumb ones)

2006-12-07 Thread [EMAIL PROTECTED]
I've been playing with the sitemap stuff and am finding it to be quite slick. I do, however, have some questions about some unusual cases. 1)It works beautifully for listing all the detail pages that make up a list view, but what about the page that takes the list view? In my case, For example,

Re: Upgrading from .95 to Development Version

2006-12-07 Thread Paul Childs
Thanks Istvan, You guessed right I am on windows. I changed the script, ran it, installed django and navigated to the built in admin site where I was greeted by the nice clean looking admin interface that I am used to seeing. --~--~-~--~~~---~--~~ You received

Re: Upgrading from .95 to Development Version

2006-12-07 Thread Istvan Albert
Paul Childs wrote: > I'm pretty sure that the download script that I found here... > http://code.djangoproject.com/ticket/1327 > must not be doing the job properly. if you are using windows you'll need to change line 41 to: fp = open(basedir + link, 'wb+') i.

Re: Upgrading from .95 to Development Version

2006-12-07 Thread Paul Childs
I'm pretty sure that the download script that I found here... http://code.djangoproject.com/ticket/1327 must not be doing the job properly. I took the media from the admin in the 0.95 release and replaced the dev version's media and that fixed a good chunk of it. I'll have to do a SVN

Re: Upgrading from .95 to Development Version

2006-12-07 Thread Istvan Albert
Adrian Holovaty wrote: > I have never seen anything like that. I suspect the images are > corrupted somehow, and I have no idea how that might have happened. One common cause is opening files in text mode under windows. The flags need to be 'wb' not just 'w' i.

Re: Upgrading from .95 to Development Version

2006-12-07 Thread Adrian Holovaty
On 12/7/06, Paul Childs <[EMAIL PROTECTED]> wrote: > Well, I tried again and installed everything from scratch - new > project, app, database. I went through the first two sections of the > tutorial and I still got the same problem. I have posted this image of > the problem which shows how the

Re: Re: Upgrading from .95 to Development Version

2006-12-07 Thread James Bennett
On 12/7/06, Paul Childs <[EMAIL PROTECTED]> wrote: > I think this is a serious problem, should this be posted on the > developer group or a ticket raised? The images and CSS in the admin haven't changed, so I'm wondering if this is an issue with your browser or with a corrupt download maybe...

Re: Upgrading from .95 to Development Version

2006-12-07 Thread Paul Childs
Well, I tried again and installed everything from scratch - new project, app, database. I went through the first two sections of the tutorial and I still got the same problem. I have posted this image of the problem which shows how the admin looks through Firefox...

Re: is there a way to combine generic views?

2006-12-07 Thread Condredge
Hey Anton, Another option is to write a wrapper view that makes use of the generic views but adds more to it. James Bennett over at B-List wrote a very useful article on this: http://www.b-list.org/weblog/2006/11/16/django-tips-get-most-out-generic-views

Re: displaying thumbnails in admin

2006-12-07 Thread [EMAIL PROTECTED]
Why is that the worst idea? --~--~-~--~~~---~--~~ 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

Re: Optimizing Templates

2006-12-07 Thread Don Arbow
On Dec 7, 2006, at 8:15 AM, [EMAIL PROTECTED] wrote: > > Right off the top, I'd suggest alot of your slowdown is in the number > of http requests. It appears you're making quite a few javascript and > css calls. I'd see if i could pare that back. > > > Also, temporarily remove your google

Re: Re: is there a way to combine generic views?

2006-12-07 Thread Jay Parlar
On 12/7/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > On 12/7/06, Anton Daneika <[EMAIL PROTECTED]> wrote: > > I want a page which displays both the details of an object and the list of > > the objects. Is there a known way to combine generic views to produce such a > > thing? The problem is

Re: filter by related record

2006-12-07 Thread Rory Campbell-Lange
On 07/12/06, Rory Campbell-Lange ([EMAIL PROTECTED]) wrote: > I'm not sure how to do a join against a related record: > > g=SiteEnergy.objects.filter(siteyear=9, energy__isofsite=False) > raise TypeError, "Cannot resolve keyword '%s' into field" % name > TypeError: Cannot resolve keyword

filter by related record

2006-12-07 Thread Rory Campbell-Lange
I'm not sure how to do a join against a related record: g=SiteEnergy.objects.filter(siteyear=9, energy__isofsite=False) raise TypeError, "Cannot resolve keyword '%s' into field" % name TypeError: Cannot resolve keyword 'energy' into field g=SiteEnergy.objects.filter(siteyear=9,

Re: Read only fields once created

2006-12-07 Thread Ross Burton
MerMer wrote: > You can add "editable=False" to you database model. This prevents it > from showing up in Admin, though of course it can still be edited > directly in the DB. This stops it being set in the admin when creating a new object, which isn't what I want. I think I'll have to hack

Re: Optimizing Templates

2006-12-07 Thread [EMAIL PROTECTED]
Well it's none of that. The template process time is literally 150-500ms using the profiling stuff... On Dec 7, 5:15 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Right off the top, I'd suggest alot of your slowdown is in the number > of http requests. It appears you're making quite a few

Re: Optimizing Templates

2006-12-07 Thread [EMAIL PROTECTED]
Right off the top, I'd suggest alot of your slowdown is in the number of http requests. It appears you're making quite a few javascript and css calls. I'd see if i could pare that back. Also, temporarily remove your google analytics code... I've seen that cause a major hang on some sites.

Re: HTTP PUT and DELETE with Django?

2006-12-07 Thread Adrian Holovaty
On 12/7/06, cmars232 <[EMAIL PROTECTED]> wrote: > Is it possible to process HTTP PUT and DELETE requests with Django? If > so, how would I access the data uploaded in an HTTP PUT? Try accessing request.raw_post_data, perhaps?

Re: Admin 404s on users

2006-12-07 Thread [EMAIL PROTECTED]
I got it! I had a mismatch between content_types and permissions. Not sure how it happened, but it's fixed! Thanks to everyone, espeically Adrian, for your help. I feel like I can actually use the admin again! --~--~-~--~~~---~--~~ You received this message

Re: Admin 404s on users

2006-12-07 Thread Adrian Holovaty
On 12/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > ContentType matching query does not exist. > [...] > I'm not exactly sure what it means, but it's DEFINITELY more helpful. > Perhaps I should look at my content-type table? Run this code: """ from django.contrib.contenttypes.management

HTTP PUT and DELETE with Django?

2006-12-07 Thread cmars232
Is it possible to process HTTP PUT and DELETE requests with Django? If so, how would I access the data uploaded in an HTTP PUT? (I would like to build a RESTful interface to some Django models. I guess I can use POST to upload if I have to, but would like to try using PUT if possible.)

Re: Admin 404s on users

2006-12-07 Thread [EMAIL PROTECTED]
Still no go... what the hell is it looking for? --~--~-~--~~~---~--~~ 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

Re: Optimizing Templates

2006-12-07 Thread [EMAIL PROTECTED]
Good luck, here's one page's set: ### bone.html ### {% load profiling %} http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;> http://www.w3.org/1999/xhtml; lang="{{ LANGUAGE_USED }}" xml:lang="{{ LANGUAGE_USED }}"> http://www.curse-gaming.com; />

Re: Optimizing Templates

2006-12-07 Thread Adrian Holovaty
On 12/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Any Tips? > > Our templates are running from 150ms-500ms process times, something we > really need to cut down. As far as I can tell it's not doing any > queries in them. If you copy-and-paste us your templates, we may be able to give

Optimizing Templates

2006-12-07 Thread [EMAIL PROTECTED]
Any Tips? Our templates are running from 150ms-500ms process times, something we really need to cut down. As far as I can tell it's not doing any queries in them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: is there a way to combine generic views?

2006-12-07 Thread Adrian Holovaty
On 12/7/06, Anton Daneika <[EMAIL PROTECTED]> wrote: > I want a page which displays both the details of an object and the list of > the objects. Is there a known way to combine generic views to produce such a > thing? The problem is that all generic views return HttpResponse which I > don't need

datetime.now()

2006-12-07 Thread Todd O'Bryan
How can I get the current time in a way that respects the time zone I've set in Django settings? Or, alternatively, how do I convert a string like 'America/New York' into a timezone object? Thanks, Todd --~--~-~--~~~---~--~~ You received this message because

is there a way to combine generic views?

2006-12-07 Thread Anton Daneika
Greetings, django users. I want a page which displays both the details of an object and the list of the objects. Is there a known way to combine generic views to produce such a thing? The problem is that all generic views return HttpResponse which I don't need in that case -- just the processing.

Re: Admin 404s on users

2006-12-07 Thread [EMAIL PROTECTED]
Ah ha! DoesNotExist at /admin/auth/user/1/ ContentType matching query does not exist. Request Method: GET Request URL:http://gretschpages.com/admin/auth/user/1/ Exception Type: DoesNotExist Exception Value:ContentType matching query does not exist. Exception Location:

Upgrading from .95 to Development Version

2006-12-07 Thread Paul Childs
The firewall has the SVN port closed off so when I noticed this ticket http://code.djangoproject.com/ticket/1327 I was encouraged to go and get a development version of Django. I scooped the script and ran it and lo and behold I had Revision 4179 of the 96-pre version of Django! I uninstalled my

Re: DJANGO_SETTINGS_MODULE undefined error

2006-12-07 Thread Baurzhan Ismagulov
Hello Thejaswi, On Thu, Dec 07, 2006 at 09:59:28AM -, theju wrote: > whenever i use the following command (in a python shell) > I get the following error. > EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is > undefined. Set it in your shell before starting python. I do the

Re: Admin 404s on users

2006-12-07 Thread Adrian Holovaty
On 12/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Also, I commented out all apps in settings.py except the "default" > django ones, and it still happened. > > Anyone got any more ideas? I kind of need user admin! Hey Tim, "svn update" your code, assuming you're using the Django

DJANGO_SETTINGS_MODULE undefined error

2006-12-07 Thread theju
Hi, I use Django 0.95 with python 2.4.4 on Fedora Core 6. I want to use the object_list generic view from django.views.generic.list_detail.object_list, but whenever i use the following command (in a python shell) >>> from django.views.generic import list_detail I get the following error. ///

How would I add a custom widget in the admin for a ManyToMany relationship?

2006-12-07 Thread naitsirhc
Hello, I am currently working on a Django app and am quite pleased with the framework overall. The problem I am currently having is that the default Django admin widget for a ManyToMany relationship is a multiple select box. This is causing a big problem for me since I have thousands of

Re: Anonymous Sessions

2006-12-07 Thread Jeremy Dunck
On 12/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hrm if that's the case, I msut have slipped up in the code somewhere. > Thanks :) > > I'll go see if i am inserting into sessions for some reason if they're > anonymous. To aid in things like this, I used a modded version of sessions

model field question

2006-12-07 Thread Rob Slotboom
For a model I have defined two table fields. To fill those fields in admin I want to provide an extra dropdown field. Is it possible to add an extra field to the model without creating a corresponding database field? The use: field1 = content_type_id field2 = content_item_id Extra dropdown

Re: test client - Keeps returning 301 status code and not sure why.

2006-12-07 Thread MerMer
Russ, I think I had failed to import everything. I have now used "from django import * with partial success. Then I tried. >>c=Client() >>d=c.get('/promotions/') >>d.content This worked and returned me a large page of in my shell view. However, >>d.context >>d.template returns nothing.

M2M order-problem

2006-12-07 Thread patrickk
class GradeMembers(models.Model): grade = models.ForeignKey(Grade, edit_inline=models.TABULAR) user = models.ForeignKey(User, raw_id_admin=True, core=True) grade_group = models.ManyToManyField(GradeGroup) this doesn´t work: grademembers =

Re: Re: Singleton model instance

2006-12-07 Thread Phil Powell
Thanks for the input guys. I'm kind of approaching this from a client perspective, so was fishing around for the simplest use case from an inexperienced admin user's point of view. The suggestions of using a Page and "chunk" schema makes perfect sense, and a quick Google threw up a good

Re: Re: test client - Keeps returning 301 status code and not sure why.

2006-12-07 Thread Russell Keith-Magee
On 12/7/06, MerMer <[EMAIL PROTECTED]> wrote: > > Russ, > > Many thanks for the response. However, c.response isn't working for > me. I'm getting "No attribute found". Running dir(c) does not show up > this method. That's wierd. I can't think of any obvious reason that that would happen. Ok -

Re: Re: test client - Keeps returning 301 status code and not sure why.

2006-12-07 Thread James Bennett
On 12/7/06, MerMer <[EMAIL PROTECTED]> wrote: > Many thanks for the response. However, c.response isn't working for > me. I'm getting "No attribute found". Running dir(c) does not show up > this method. Random, possibly silly question: do you have CommonMiddleware enabled with APPEND_SLASH =

Re: Fast fcgi on dreamhost --> shauwn of the dead, help me shoot zombies

2006-12-07 Thread Phil
Yes, me too It failed twice since Monday morning. )c: But 'happily', it is not a mission critical site, so I can afford to have some downtime from time to time. Which you luck. Phil. On Dec 6, 11:43 pm, "coulix" <[EMAIL PROTECTED]> wrote: > I did the rename trick, still screw today. > I will

Re: test client - Keeps returning 301 status code and not sure why.

2006-12-07 Thread MerMer
Russ, Many thanks for the response. However, c.response isn't working for me. I'm getting "No attribute found". Running dir(c) does not show up this method. MerMer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Fast fcgi on dreamhost --> shauwn of the dead, help me shoot zombies

2006-12-07 Thread Ramdas S
Me too. I am looking at putting up a dedicated web server. Its going to cost me between 1200 to 1600 USD a year compared to $99 I paid Dreamhost. But I think it will be worth it. Ramdas On 12/7/06, coulix <[EMAIL PROTECTED]> wrote: > > > I did the rename trick, still screw today. > I will