need for caching POST requests

2010-01-12 Thread hinnack
Hi, I need to cache POST requests, too, on certain requests. The requests are not changing data, but imagine an XMLRPC service (that is based on POST requests only per spec anyway) uses functions, that always return the same like 2 + 2 SHOULD always return 4 :-) The site I have could use the

Re: Namespace Security

2010-01-12 Thread James Bennett
On Mon, Jan 11, 2010 at 10:46 AM, Tim wrote: > The issue is getting Django admin to recognize this. Has anyone seen > or done anything like this? I have a few ideas where to begin, but > figured I would ask first so I don't end up re-inventing the wheel if > something has

Re: Table with 4 Milions of rows

2010-01-12 Thread Jani Tiainen
I've only 21 million rows in one of my tables and querying it is not a problem. First check that suggested function based index, it might help and you don't need to do anything. istartswith uses "not so good" format. We have got around it using additional field that is autopopulated, in your case

Re: Namespace Security

2010-01-12 Thread Jani Tiainen
On Wed, 2010-01-13 at 10:20 +1100, Justin Steward wrote: > I had a similar requirement for a current project. Users in the admin > needed to be able to see ONLY the objects that they had created. > > My solution was: > 1) http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser > 2) Add

Re: list_display functionality for inlines ?

2010-01-12 Thread Marco Rogers
I'm trying to find a solution to this very same issue. At the very least, I think inlines should support custom callables. The inline I'm displaying is an intermediary table for a ManyToMany relationship. So I have a selector for the related object, but what I would like to do in the inline is

Re: django.core.email problem

2010-01-12 Thread vlk
Sorry for the code formatting. Nevertheless, I`ve already tryed this kind of setting and was getting the "Connection timed out" socket error. It seems that some smtp-servers require the connection to be ssl- encrypted from the very start, without special enabling. On Jan 13, 5:22 am, phan sarak

Re: django.core.email problem

2010-01-12 Thread phan sarak
Try look at http://www.packtpub.com/article/friends-via-email-social-web-application-django-1.0 On Wed, Jan 13, 2010 at 8:59 AM, vlk wrote: > I use an smtp server that requires smtplib.SMTP_SSL class to be used > for email sending. The usual EMAIL_USE_TSL=True setting

django.core.email problem

2010-01-12 Thread vlk
I use an smtp server that requires smtplib.SMTP_SSL class to be used for email sending. The usual EMAIL_USE_TSL=True setting doesn`t work. Changing following lines in the django.core.mail module from self.connection = smtplib.SMTP(self.host, self.port,

admin action to download some files

2010-01-12 Thread Viktor
Hi, I'm creating an invoicing application, and the idea is to download the invoices as pdf files using an admin action. Something like: def create_invoices(modeladmin, request, queryset): invoices = [] for invoice in queryset: invoices.append(invoice.as_pdf()) return

Attempting to Implement the Feeds Example

2010-01-12 Thread Robert Capps
but receive the error below. Completely new at django so help is appreciated. Environment: Request Method: GET Request URL: http://localhost:8080/feeds/latest/ Django Version: 1.1 Python Version: 2.6.2 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes',

Re: Namespace Security

2010-01-12 Thread Justin Steward
I had a similar requirement for a current project. Users in the admin needed to be able to see ONLY the objects that they had created. My solution was: 1) http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser 2) Add foreign key to model to track which user created the object. 3) Use the

adding multiple associations within a form

2010-01-12 Thread kkerbel
In theory, given a form exists which allows the user to choose from a drop down list of editorial boards that they could potentially be a part of...and given a list of positions within an editorial board (i.e. editor in chief, guest editor, co editor, etc)...what would be the most efficient way to

Re: Table with 4 Milions of rows

2010-01-12 Thread akaariai
On 12 tammi, 22:20, nameless wrote: > The table is queried from ajax using an autocomplete field with this > query in the views.py: > > books.objects.filter(book_title__istartswith=request.GET['q'])[:100] > At least in postgres you need a special kind of index to run

m2m in views

2010-01-12 Thread shaner
I'm trying to make a model's detail view, take movies for example; actors are m2m to movies this works but it doesn't feel right is there, i pass this context to the template where i for loop through the actor list >>> Movie.objects.filter(pk=movie_id)[0].character.all() [, ] -- You received

Re: SQL modulus using QuerySet API

2010-01-12 Thread Ryan Nowakowski
On Tue, Jan 12, 2010 at 01:40:50PM -0800, Daniel Roseman wrote: > On Jan 12, 9:29 pm, Ryan Nowakowski wrote: > > I have a model that has an IntegerField.  I'd like to filter only the > > even integers.  sqlite has a modulus operator so I can do: > > > >   select * from

Migrating Many-To-Many Relationship

2010-01-12 Thread David Nolen
When migrating an existing db how do you create a proper join table for a ManyToMany field. I think I've got it mostly worked out except for the bit that looks like this in Django generated SQL: CREATE TABLE `blog_posts_authors` ( `id` int(11) NOT NULL AUTO_INCREMENT, `post_id` int(11) NOT

Re: SQL modulus using QuerySet API

2010-01-12 Thread Daniel Roseman
On Jan 12, 9:29 pm, Ryan Nowakowski wrote: > I have a model that has an IntegerField.  I'd like to filter only the > even integers.  sqlite has a modulus operator so I can do: > >   select * from mytable where my_int = my_int % 2 Er, that doesn't give you even integers, it

SQL modulus using QuerySet API

2010-01-12 Thread Ryan Nowakowski
I have a model that has an IntegerField. I'd like to filter only the even integers. sqlite has a modulus operator so I can do: select * from mytable where my_int = my_int % 2 However, I'd like to use the QuerySet API to do this instead of resorting to SQL. Any ideas or hints? Thanks, Ryan

Re: Table with 4 Milions of rows

2010-01-12 Thread Chris Czub
What might be useful is to figure out exactly what SQL Django winds up running then doing an "EXPLAIN " on that query in your DBMS from the command line. That will let you know what the backend is doing and what the performance considerations you should take are. On Tue, Jan 12, 2010 at 3:20 PM,

Re: Table with 4 Milions of rows

2010-01-12 Thread nameless
The table is queried from ajax using an autocomplete field with this query in the views.py: books.objects.filter(book_title__istartswith=request.GET['q'])[:100] --- On Jan 12, 8:47 pm, Chris Czub wrote: > It really depends on how you're selecting the data

Model inheritance

2010-01-12 Thread a b
Hi, I have three models: Product SimpleProduct that extends Product GroupProduct that extends Product and have ManyToMany relation with SimpleProduct The reason to use the base Product model is so I can use paging. Is it possible to make a query that gives a list of GroupProducts and

Re: Table with 4 Milions of rows

2010-01-12 Thread Chris Czub
It really depends on how you're selecting the data from the database. If you're doing something that necessitates a full table scan(like in-DB ORDER BY) it will slow you down considerably. If you're selecting one row from the database by an indexed column, then the performance will be very fast

Re: Table with 4 Milions of rows

2010-01-12 Thread Michael Thon
On Jan 12, 2010, at 8:25 PM, nameless wrote: > My table with 4 milions of rows is queried often by ajax. > So I think a performance problems ( I am using also index ). > Ok now take a look at the contenttypes :) I don't know what overhead django will put on the queries but 4 million rows

Re: Table with 4 Milions of rows

2010-01-12 Thread Victor Loureiro Lima
Cache the content of the table, maybe using memcached,and only go to the DB if needed. Victor Lima 2010/1/12 nameless > My table with 4 milions of rows is queried often by ajax. > So I think a performance problems ( I am using also index ). > Ok now take a look at the

Re: Table with 4 Milions of rows

2010-01-12 Thread nameless
My table with 4 milions of rows is queried often by ajax. So I think a performance problems ( I am using also index ). Ok now take a look at the contenttypes :) On Jan 12, 8:15 pm, Tim wrote: > As far as needing to split up the table into other tables, I'm

Re: {% url admin:index %} generating wrong urls

2010-01-12 Thread Chris Withers
davathar wrote: Unfortunately adding the rewrite rule mentioned as a work around hasn't worked for me. Please post the relevant section of your Apache config (including your wsgi *and* rewrite lines), there's no reason the rewrite rule workaround shouldn't work for you... Chris --

Re: Table with 4 Milions of rows

2010-01-12 Thread Tim
As far as needing to split up the table into other tables, I'm not sure. Whats wrong with having 4 million records in one table? But if you're going to do it, take a look at the contenttypes framework and generic relations. It basically does what you're describing:

Re: contrib.comments get_absolute_url raising 404 only on remote server

2010-01-12 Thread neridaj
Thanks, man, that was it. On Jan 12, 3:39 am, bruno desthuilliers wrote: > On 12 jan, 03:32, neridaj wrote: > > > I've been testing my site locally and figured I should commit some of > > my changes. I'm using django.contrib.comments and for

Re: Django performance on Amazon EC2

2010-01-12 Thread Victor Loureiro Lima
Yes, with proper caching and well-tuned queries sure you can, and thats what I did, if you read the thread, and then, only then, I managed to get "thousands of requests per seconds", indeed. But without cache and even with well-tuned queries and db indexes, I couldnt manage to go over 10

Table with 4 Milions of rows

2010-01-12 Thread nameless
Hi at all. I have a project with 2 applications ( books and reader ). Books application has a table with 4 milions of rows with this fields: book_title = models.CharField(max_length=40) book_description = models.CharField(max_length=400) To avoid to query the database with 4 milions of rows,

Re: Django performance on Amazon EC2

2010-01-12 Thread CLIFFORD ILKAY
On 01/12/2010 01:12 PM, Victor Loureiro Lima wrote: Me neither, so the question remains: Is it an EC2 thing or is it common to django? I know that this topic is sensitive for overall web-development frameworks such as PHP, django, and ruby. It would be usefull if other users of this forum could

Re: Django performance on Amazon EC2

2010-01-12 Thread Victor Loureiro Lima
Me neither, so the question remains: Is it an EC2 thing or is it common to django? I know that this topic is sensitive for overall web-development frameworks such as PHP, django, and ruby. It would be usefull if other users of this forum could post on the "requests/s" and give some setup info, so

Re: Django performance on Amazon EC2

2010-01-12 Thread Malcolm Box
On Tue, Jan 12, 2010 at 5:28 PM, Steve McConville < mcconville.st...@gmail.com> wrote: > > Yes, hosted in US-East-1, but I was running benchmark tests from another > EC2 > > instance in the same region, so reasonably sure it's not latency. > > I meant latencies internal to EC2; eg. what is your

Re: Django performance on Amazon EC2

2010-01-12 Thread Steve McConville
> Yes, hosted in US-East-1, but I was running benchmark tests from another EC2 > instance in the same region, so reasonably sure it's not latency. I meant latencies internal to EC2; eg. what is your ping time between the frontend and the DB box? The article I linked to reports that this has been

Re: Django performance on Amazon EC2

2010-01-12 Thread Victor Loureiro Lima
Yes, we are also on a m1.small instance. The bench we ran in our development environment went bad, but that was mostly because its a virtual machine, shared with a few other resources, plus the DB machine was also under high usage and shared, thats why we had aprox. 10 request/s on dev env. So

Re: Django performance on Amazon EC2

2010-01-12 Thread Malcolm Box
On Tue, Jan 12, 2010 at 2:54 PM, Victor Loureiro Lima < victorloureirol...@gmail.com> wrote: > Hello, > > we currently have a website running on django EC2, and its running great, > really great. We managed to handle 300 requests/s on our stress tests on a > heavy page... but, we only managed to

Re: Django performance on Amazon EC2

2010-01-12 Thread Victor Loureiro Lima
Yes, me too.. The benchmark were executed from another EC2 instance, so we could ignore latency. cheers, victor lima 2010/1/12 Malcolm Box > On Tue, Jan 12, 2010 at 2:46 PM, Steve McConville < > mcconville.st...@gmail.com> wrote: > >> > EC2 m1.small instance, talking to

Re: Django performance on Amazon EC2

2010-01-12 Thread Malcolm Box
On Tue, Jan 12, 2010 at 2:46 PM, Steve McConville < mcconville.st...@gmail.com> wrote: > > EC2 m1.small instance, talking to another m1.small instance hosting MySQL > db > > > > DB performance doesn't seem to be the issue - I don't see the DB server > > under any load at all. > > What sort of

Re: Namespace Security

2010-01-12 Thread Tim
There are a few changes to the filter syntax if you want to get records that a certain user has access to. So lets say Cars are "namespaced". To get all the cars that are colored blue, you can still do this. Cars.objects.filter(color='blue') But to get all the cars that are color blue that only

Re: How to get ModelAdmin given a Model

2010-01-12 Thread Marco Rogers
I'm currently using the site._registry approach. I was hoping there was either a more "official" way. Incidentally, the registry is a dict so you should be able to access the model directly. from django.contrib import admin def get_admin(model): if model in admin.site._registry

Re: Django performance on Amazon EC2

2010-01-12 Thread Victor Loureiro Lima
Hello, we currently have a website running on django EC2, and its running great, really great. We managed to handle 300 requests/s on our stress tests on a heavy page... but, we only managed to get that after we used the django's cache systems, before that we were running close to 10 requests/s

Re: Django performance on Amazon EC2

2010-01-12 Thread Steve McConville
> EC2 m1.small instance, talking to another m1.small instance hosting MySQL db > > DB performance doesn't seem to be the issue - I don't see the DB server > under any load at all. What sort of network latencies are you seeing? Are they hosted in US-East-1?

Re: Namespace Security

2010-01-12 Thread Shawn Milochik
Tim, I look forward to seeing what you've put together. I'm not so much hung up on terminology (group versus namespace) as functionality. I mentioned the specifics in my last post, regarding not having to change the Django queryset syntax in every view in the application. Does your solution

Django performance on Amazon EC2

2010-01-12 Thread Malcolm Box
Hi, I'm using Django on Amazon EC2 and seeing what I think are very low throughputs ( < 15requests/s) for relatively simple pages. Before I start digging into the root causes of this, I wondered if anyone else was running Django on AWS and what sort of performance figures you were seeing. More

Re: Namespace Security

2010-01-12 Thread Tim
There's some good stuff in here. My requirements are a little different than straight-up row level security. I have a working prototype that I'm going to post on github later today. It was a lot easier than I thought it would be. It uses all the standard django permissions (create/change/delete

Re: Namespace Security

2010-01-12 Thread Shawn Milochik
On Jan 12, 2010, at 8:04 AM, Gonzalo Delgado wrote: > > I'm facing similar requirements and came across this app: > >http://packages.python.org/django-authority/ > > but haven't tried it out yet. > Well, I just read most of the docs, and it looks like this won't work for our

Re: multiple database on django please helpme..

2010-01-12 Thread chiranjeevi muttoju
hi Gonzalo, i did nt find any help there.. could u please bclearer.. i really ned it.. if u know plz help me... On Tue, Jan 12, 2010 at 7:35 PM, Gonzalo Delgado wrote: > El 12/01/10 11:02, Shawn Milochik escribió: > > This will help you get help: > > > >

Re: Namespace Security

2010-01-12 Thread Shawn Milochik
On Jan 12, 2010, at 8:04 AM, Gonzalo Delgado wrote: >> > > I'm facing similar requirements and came across this app: > >http://packages.python.org/django-authority/ > > but haven't tried it out yet. > > -- > Gonzalo Delgado > Thanks, I'm looking into it now. It

Re: multiple database on django please helpme..

2010-01-12 Thread Gonzalo Delgado
El 12/01/10 11:02, Shawn Milochik escribió: > This will help you get help: > > http://catb.org/~esr/faqs/smart-questions.html > +1 -- Gonzalo Delgado -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: multiple database on django please helpme..

2010-01-12 Thread Shawn Milochik
This will help you get help: http://catb.org/~esr/faqs/smart-questions.html -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to

multiple database on django please helpme..

2010-01-12 Thread chiranjeevi.muttoju
hello all could u please help me.. i want to use the multiple database in django.. i fallowed somany procedures.. but i cont able to get how to use.. could u please tell me in detailed the process for multiple databases in django.. with sample settings.. please help me if u know this.. thank

Re: Problem with inline form: "__init__() got an unexpected keyword argument 'instance'"

2010-01-12 Thread Jop
Hi Daniel, Thanx for the suggestions, i've got it working now! Up to the next challenge :) Greets Jop On 12 jan, 12:17, Daniel Roseman wrote: > On Jan 12, 10:54 am, Jop wrote: > > > > > Hello, > > > I struggeling with an error message for more

Re: Namespace Security

2010-01-12 Thread Gonzalo Delgado
El 11/01/10 13:46, Tim escribió: > There is an interesting requirement in a project I am working on. For > lack of a better term, I'll call it Namespace Security. Basically, > there are arbitrary namespaces that can be defined, and every object > belongs to a namespace. Then, users only have

Re: Design Question - Extending a model

2010-01-12 Thread Jason Beaudoin
On Mon, Jan 11, 2010 at 12:00 PM, Igor wrote: > Thanks a lot - I didn't know about generic relations, and will > definitely look at them - right now :). I start thinking about extending models (and other DRY mode/db methods) when I see myself repetitively typing out

Re: contrib.comments get_absolute_url raising 404 only on remote server

2010-01-12 Thread bruno desthuilliers
On 12 jan, 03:32, neridaj wrote: > I've been testing my site locally and figured I should commit some of > my changes. I'm using django.contrib.comments and for some reason the > comment.get_absolute_url is resulting in a broken link on the live > server. When I mouse over

Re: Problem with inline form: "__init__() got an unexpected keyword argument 'instance'"

2010-01-12 Thread Daniel Roseman
On Jan 12, 10:54 am, Jop wrote: > Hello, > > I struggeling with an error message for more than a day now and I > can't figure out what I'm doing wrong. I'm still kindof a newbie with > python/django so it might be very obvious.. > > I am trying to create an inline form and

Problem with inline form: "__init__() got an unexpected keyword argument 'instance'"

2010-01-12 Thread Jop
Hello, I struggeling with an error message for more than a day now and I can't figure out what I'm doing wrong. I'm still kindof a newbie with python/django so it might be very obvious.. I am trying to create an inline form and I want to hide a field in this form (specific: I want to hide the pk

Re: What is the uploaded file full path name

2010-01-12 Thread tsmets
This is ok if I did not want to use the possibility to upload to a directory containing the the date... If you read the specs : http://docs.djangoproject.com/en/1.1/ref/models/fields/#filefield I can speciify that the upload path is formatted with : DEFAULT_UPLOAD_SUBFOLDER = 'upload/%Y/%m/%d'

Re: using relationship fields in ModelAdmin

2010-01-12 Thread Daniel Roseman
On Jan 12, 5:32 am, Mike Thon wrote: > I have an object in my model that has a OneToOne relationship with an > object in another app.  I would like to customize the way my object is > displayed in the admin interface by subclassing ModelAdmin as shown in > the tutorial.  I'm

Re: How crypt python code

2010-01-12 Thread Masklinn
On 12 Jan 2010, at 09:47 , Jirka Vejrazka wrote: > > Hi, > > You can't really. The code has to be executed, therefore it has to > be readable by the server. So, by definition, it is readable by sever > admin(s).. You could implement some obfuscation, but it,s not really > worth it. Well you can

Re: How crypt python code

2010-01-12 Thread Robert S
You could try uploading your .pyc files, without your .py source. That will be something of a maintenance night-mare, but should work -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: How crypt python code

2010-01-12 Thread Jirka Vejrazka
Hi, You can't really. The code has to be executed, therefore it has to be readable by the server. So, by definition, it is readable by sever admin(s).. You could implement some obfuscation, but it,s not really worth it. The best you can do is to check your hosting contract/agreement, see

Re: Form Validation in Admin

2010-01-12 Thread Sasuke
thanks very much. it seems self.instance always exists but its pk(id) is None when it's an add and not None when it's modification. - Original Message - From: "Daniel Roseman" To: "Django users" Sent: Monday, January 11, 2010