Re: django 1.1 performance versus django 1.2 performance

2011-04-25 Thread Peter Portante
But what changed in 1.2 vs. 1.1 that caused cloning to become slower? Is it fixes for correctness that were missing? And if 1.3 is slower than 1.2, why the slow down there? If the slowness is for a good reason (correctness is about the only one I can think of that is really valid), then fine.

Re: django 1.1 performance versus django 1.2 performance

2011-04-25 Thread Alexander Schepanovski
> Is there a way to identify which queries use cloning? Every filter, exclude, order_by, select_related and some other calls clones it. Slicing too. > Is there a way rewrite those queries to avoid cloning overhead? You can rewrite qs.filter(a=1).exclude(b=2) as qs.filter(Q(a=1) & !Q(b=2)) or qs

Re: Dynamically form modification - Is this possible?

2011-04-25 Thread Shawn Milochik
There are two pieces to this. 1. The Django form. 2. Whatever comes back in your HTML form's POST. Your Django form will have zero or more fields in it. Your HTML form will POST back those fields (if any) and possibly new ones. Your Django form's __init__ will read the 'data' keyword

Re: Need advice on ecommerce app direction

2011-04-25 Thread Russell Keith-Magee
On Tuesday, April 26, 2011, Ernesto Guevara wrote: > I find for download "Beginning Django E-Commerce" in webmasterresourceskit > site. Look that. No - don't do that. And don't ever suggest that again. The site you have referenced is a pirate site, providing illegal

Re: Dynamically form modification - Is this possible?

2011-04-25 Thread BrendanC
I was hoping to use ajax and a customizable template with the additional fields that I'd added dynamically and then somehow update the form class with the info required to support form validation (however I'm not sure that this approach will work - I can get the initial display to work, but not

Using different choices in different ModelAdmins

2011-04-25 Thread Juan Pablo Romero Méndez
Hello, I'm developing several personalized admin sites (by subclassing admin.ModelAdmin). Is it possible to use different Field.choices in a particular field for each admin site? The problem is that the choices option is set within the model definition, not in the ModelAdmin. Regards, Juan

Re: URLs in error messages from form validation

2011-04-25 Thread Daniel Gerzo
On 25.4.2011 18:00, Jason Culverhouse wrote: You only need to mark the string as safe as in: http://docs.djangoproject.com/en/1.3/ref/utils/#module-django.utils.safestring from django.utils.safestring import mark_safe raise forms.ValidationError(mark_safe('We already have this filehere'))

Re: Need advice on ecommerce app direction

2011-04-25 Thread Ernesto Guevara
I find for download "Beginning Django E-Commerce" in webmasterresourceskit site. Look that. Regards. 2011/4/25 Shant Parseghian > Hi all, I'm aware of the choices out there for Django ecommerce apps but im > confused about which to use. I need a simple shop that will do

Re: {{ STATIC_URL }} and RequestContext()

2011-04-25 Thread Ernesto Guevara
Hello! You need create a "static" folder in your project and inside in this folder you create a "css" folder. I use this configuration and works. settings.py import os.path STATIC_ROOT = '' # URL prefix for static files. STATIC_URL = '/static/' ADMIN_MEDIA_PREFIX = '/static/admin/'

Re: Dynamically form modification - Is this possible?

2011-04-25 Thread Shawn Milochik
I was assuming you'd use JavaScript to dynamically add elements to the DOM during the user experience. How else would you do it? Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Dynamically form modification - Is this possible?

2011-04-25 Thread BrendanC
I'm still not clear on how/whether it is possible to MODIFY the form once it's been initially displayed - the __init__ method is invoked when the form is first created/constructed - what I want to do is rerender/redisplay the form with new fields after it's initial display -since the form

Need advice on ecommerce app direction

2011-04-25 Thread Shant Parseghian
Hi all, I'm aware of the choices out there for Django ecommerce apps but im confused about which to use. I need a simple shop that will do delivery only so no shipping needs to be calculated. I'm thinking that Satchmo will be overkill for this. Does anyone have any suggestions? -- You received

Need a OneToOne form inside another form

2011-04-25 Thread Guevara
Hello! I have a OneToOne relationship between employee and address, and I need that form of address appears in the form of employee. I saw that Django creates a ComboBox address and load all the addresses of the batabase, what is wrong. I can not use inline because the OneToOne is in employee

{{ STATIC_URL }} and RequestContext()

2011-04-25 Thread Joakim Hove
Hello, I have just started using the {{ STATIC_URL }} template tag to insert proper url's to static resources in my templates. To use this tag I need to create the context for rendering as RequestContext() instance, which takes the request as a parameter for the initialisation. In my code I have

Re: class-based generic views and forms

2011-04-25 Thread lingrlongr
A lifesaver you are! Thx DR! On Apr 25, 4:37 pm, Daniel Roseman wrote: > On Monday, April 25, 2011 9:16:18 PM UTC+1, lingrlongr wrote: > > > I have a view that subclasses uses django.views.generic UpdateView. > > In my template, I'm trying to access a form field's

Re: django and fastcgi losing some info in request data

2011-04-25 Thread xiao_haozi
I could just manually check and add it before working with the model like: stump_split = list(this_stump.partition(":")) if stump_split[1] and not stump_split[2].startswith("//"): stump_split[2] = "/"+stump_split[2] this_stump = ''.join(stump_split)

Re: class-based generic views and forms

2011-04-25 Thread Daniel Roseman
On Monday, April 25, 2011 9:16:18 PM UTC+1, lingrlongr wrote: > > I have a view that subclasses uses django.views.generic UpdateView. > In my template, I'm trying to access a form field's required > property. For example: > > {% for field in form %} >{{ field.required }} > {% endfor %}

class-based generic views and forms

2011-04-25 Thread lingrlongr
I have a view that subclasses uses django.views.generic UpdateView. In my template, I'm trying to access a form field's required property. For example: {% for field in form %} {{ field.required }} {% endfor %} Nothing outputs when the template is rendered. Does the "required" attribute not

django and fastcgi losing some info in request data

2011-04-25 Thread xiao_haozi
Hi all- I have a problem that is driving me to the brink of insanity. I'll preface this with the fact that running the built-in server everything works fine. I encounter this issue running it via fastcgi and lighttpd. I will paste in all relevant info at the bottom. In short, the workflow

Re: How do I decode a string that it is received by a filter ???

2011-04-25 Thread Rafael Durán Castañeda
On 25/04/11 20:40, Ariel wrote: The site is deploy in an apache server, that does not help. Do you have any other idea ??? I thought this would be very easy to solve. I'd thanks any help. Regards Ariel On Mon, Apr 25, 2011 at 6:21 PM, Oleg Lomaka

Re: django 1.1 performance versus django 1.2 performance

2011-04-25 Thread ydjango
Is there a way to identify which queries use cloning? Is there a way rewrite those queries to avoid cloning overhead? (If many of the queries use cloning then migrating one of my django apps to 1.2.x may not be right for me.) On Apr 25, 9:39 am, djeff wrote: > Russ, > >

Work around restarting server on image uploads?

2011-04-25 Thread neridaj
Hello, Is there a way to get uploaded images to render without having to restart the server? Whenever I add a new image via the admin interface I have to restart apache in order for the images to render. Thanks, Jason -- You received this message because you are subscribed to the Google

Re: How do I decode a string that it is received by a filter ???

2011-04-25 Thread Ariel
The site is deploy in an apache server, that does not help. Do you have any other idea ??? I thought this would be very easy to solve. I'd thanks any help. Regards Ariel On Mon, Apr 25, 2011 at 6:21 PM, Oleg Lomaka wrote: > Not sure if it helps in your case, but try to

Interesting race condition in Django views with decorators (fix included)

2011-04-25 Thread Cal Leeming [Simplicity Media Ltd]
So, here's an interesting race condition, which causes request bleeding to happen. If you use a decorator on a view method, where the decorator is a class, the class isn't created per request, it seems to stay the same throughout. So, if you define any logic within this class, which depends on

Re: Dynamically form modification - Is this possible?

2011-04-25 Thread Shawn Milochik
If your __init__ method of the form reads the contents of the data kwarg and adds to self.fields then you can validate the additional fields. If your form has a prefix you have to ensure that the dynamic fields that get passed in the POST also have the same prefix. However, this allows an

Dynamically form modification - Is this possible?

2011-04-25 Thread BrendanC
Is there away to dynamically modify and validate a Django form AFTER it's been created and displayed. I have a form where I want to display and validate additional input fields based on the selection from a dropdown on the initial form. (I have found a few snippets that show dynamic form

Re: Checking for user type in view

2011-04-25 Thread Shawn Milochik
You can use a user profile for a lot more, and there's no reason the two roles have to be mutually exclusive when you're creating your own class. I just wanted to make that point. I have never used the built-in groups myself, but from your explanation it seems like a good solution for the

Outputting plain/text with class-based views

2011-04-25 Thread Federico Maggi
Hello, I need a view to return plain/text and I came up with the following code: from django import http from django.views.generic.base import TemplateResponseMixin from django.views.generic.list import ListView from django.views.generic.detail import DetailView from django.conf import

Re: django 1.1 performance versus django 1.2 performance

2011-04-25 Thread djeff
Russ, Thanks for the response. You have confirmed what I'm seeing in the profile dump. The cloning of a queryset is expensive and it is more expensive in 1.2 than with 1.1. I really appreciate the feedback. Jeff Fischer -- You received this message because you are subscribed to the

sorl thumbnails

2011-04-25 Thread xeed
hi, i used sorl thumbnails to implement thumbnail in my projects, i follow the instructions but my image doest appear, i open my source web page and the link doesnt exist like this u:\python27\lib\site-packages\django\contrib\admin\media\cache \53\2a\532a8f7367b735d8f4b20064e9c2525d.jpg does

Re: How do I decode a string that it is received by a filter ???

2011-04-25 Thread Oleg Lomaka
Not sure if it helps in your case, but try to start django in UTF-8 locale. For example, LANG=en_US.UTF-8 ./manage.py runserver On Mon, Apr 25, 2011 at 6:23 PM, Ariel wrote: > I have the following problem, I have made a template filter that process a > string, but when the

Re: URLs in error messages from form validation

2011-04-25 Thread Jason Culverhouse
On Apr 25, 2011, at 5:39 AM, Kane Dou wrote: > * Daniel Gerzo [2011-04-25 13:07:46 +0200]: > >> On 25.4.2011 12:40, Kane Dou wrote: >>> * Daniel Gerzo [2011-04-24 17:52:13 +0200]: >>> Hello all, say I have a following form: class

How do I decode a string that it is received by a filter ???

2011-04-25 Thread Ariel
I have the following problem, I have made a template filter that process a string, but when the string that is passed to the filter has a non-ascii character then I received that string in the filter codified, how can I decode the string ??? For instance: in the template html I have the following

Re: Problems with running Hello world app, urls.py probably ignored

2011-04-25 Thread Jacob
> ROOT_URLCONF = 'emil.urls' What's "emil"? It needs to be projectname.urls. So probably "john.urls". --Jacob On Apr 23, 2:57 pm, Honza Javorek wrote: > Hello guys, > > I have searched to solve this for a whole evening without any results. > I have read all known "my first

Re: Ajax headers not work in all browsers?

2011-04-25 Thread Carl Nobile
>From your header it looks like HTML and XML are the only things that will get parsed correctly. You haven't mentioned what type of container your data is in. If it's XML then it should be working if it's JSON it will not work on Firefox and other browsers. the Accept header should have in it

Django 1.2 Dropped Sessions when single view contains registration and login authentication

2011-04-25 Thread benp
Hi, This issue has been raised on Stack Overflow many times without any resolution. The gist is that all of the views in my site are protected by the @login_required decorator except for a splash page and a registration page (which is only accessible by going through the splash page and passing

Block of the previous fields inline

2011-04-25 Thread jonas peters
hi, I have a question, have an administration that uses the User will inlines where adding elements as needed, but when it records the edit inlines earlier blocked a kind "readolnly" and he just can not add new and edit earlier. Sorry for my english. -- You received this message because you

Re: Extremely Frustrated

2011-04-25 Thread Gandeida
Hi Ogi, It turned out that I had some tab characters in my code that I inadvertently added when I copied and pasted. I've changed my editor settings to use spaces instead of tabs, and all is working now. Thank you for offering to help! Regards, Gandeida On Apr 22, 6:04 am, Ogi Vranesic

Re: Extremely Frustrated

2011-04-25 Thread Gandeida
Hello, I am running version 1.3. After copying and pasting about 20 more times, but getting the error sporadically, I have found that the issue was the tab characters that were being automatically generated to keep my indentation level. I've changed it to use spaces instead. Thank you for

Re: URLs in error messages from form validation

2011-04-25 Thread Kane Dou
* Daniel Gerzo [2011-04-25 13:07:46 +0200]: > On 25.4.2011 12:40, Kane Dou wrote: > >* Daniel Gerzo [2011-04-24 17:52:13 +0200]: > > > >>Hello all, > >> > >>say I have a following form: > >> > >>class MyForm(forms.Form): > >> id =

Re: [Share] Protected web APIs (short and simple)

2011-04-25 Thread Subhranath Chunder
Updated this with a django helper (decorator) to make it work without any view code changes at the receiving end. On Fri, Apr 22, 2011 at 4:52 PM, Subhranath Chunder wrote: > Hi, > > I've created a small and simple Python helper module to have protected web > APIs in

Re: URLs in error messages from form validation

2011-04-25 Thread Daniel Gerzo
On 25.4.2011 12:40, Kane Dou wrote: * Daniel Gerzo [2011-04-24 17:52:13 +0200]: Hello all, say I have a following form: class MyForm(forms.Form): id = forms.IntegerField(max_length=9) language = forms.CharField(max_length=10) file = forms.FileField() And a

Re: URLs in error messages from form validation

2011-04-25 Thread Kane Dou
* Daniel Gerzo [2011-04-24 17:52:13 +0200]: > Hello all, > > say I have a following form: > > class MyForm(forms.Form): > id = forms.IntegerField(max_length=9) > language = forms.CharField(max_length=10) > file = forms.FileField() > > And a following pseudo clean