Re: Need help intercepting SQL

2011-07-11 Thread Kirill Spitsin
On Sun, Jul 10, 2011 at 02:41:59PM -0700, Eric B wrote: > Our web site uses Django 1.2. We're adding a layer to our MySQL > database called dbShards for fragmentation (sharding). I need to > prepend instructive SQL comments (/* ... */) to UPDATE statements in > certain situations. What's the bes

Re: my frist django project Error

2011-07-11 Thread bruno desthuilliers
On Jul 9, 10:21 pm, morning yao wrote: > so ,here is the Error Traceback,i need your help,thanks! (...) > File "C:\Python27\Lib\site-packages\django\dinette\..\dinette > \models.py" in >   18. > logging.config.fileConfig(settings.LOG_FILE_NAME,defaults=dict(log_path=settings.LOG_FILE_PATH)) > Fil

Re: 'WSGIRequest' object has no attribute 'update'

2011-07-11 Thread Phang Mulianto
Hi Shawn, Here are the view called : # Create your views here. from django.shortcuts import render_to_response from django.template import RequestContext from ecomstore.cart import cart def show_cart(request, template_name="cart/cart.html"): if request.method == 'POST': postdata = re

Re: Need help intercepting SQL

2011-07-11 Thread bruno desthuilliers
On Jul 11, 4:22 am, Venkatraman S wrote: > I am taking a very wild guess, as i have not pored over the docs, > but does a middleware which proxies the sqls help you? I think > i saw one such in djangosnippets. Middlewares are only used in the request/response cycle. Not the right place for db-lev

Saint Petersburg Django meetup!

2011-07-11 Thread Valentin Golev
Hello, my fellow Django users! I'd like to invite you a meetup of Django users in Saint Petersburg, Russia, this Saturday. We think that the growing more than ever community of developers who use Django in Petersburg is overdue to meet, drink some tea and talk about the future. If you live in Sai

Re: Getting a subclass from an abstract Model

2011-07-11 Thread gontran
Hi Micky, sorry for my late answer but I havn't been working this week-end. I just tried your trick but it doesn't work. I don't think it's a probleme of manager, because if I want to query a subclass directly by its name, it works: ClassA.objects.all() works normally. On 8 juil, 19:48, Micky Hul

Re: Getting a subclass from an abstract Model

2011-07-11 Thread gontran
Nevermind, I will do differently... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. Fo

Re: Model translation

2011-07-11 Thread Uros Trebec
Did anyone try "django-nani"? https://github.com/ojii/django-nani I'm giving it a go with my multilingual project and it kind of works. The translating part works nicely, the biggest issue I have is the limited AdminModel functionality ( http://django-nani.readthedocs.org/en/latest/public/admin.h

Re: Getting a subclass from an abstract Model

2011-07-11 Thread Michal Petrucha
On Fri, Jul 08, 2011 at 09:02:06AM -0700, gontran wrote: > Hello everyone, > > > my models are defined like this: > > class MyBaseModel(models.Model): > . > class Meta: > abstract = True > > class ClassA(MyBaseModel): > .. > > class ClassB(MyBaseModel): > ..

Re: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-11 Thread i...@webbricks.co.uk
what about mentioning this as well? http://learnpythonthehardway.org/ 4 lessons through it myself, so cant rate it just yet, but some of the more experienced people in the group might know it/rate it. Matt On Jul 11, 4:30 am, Kenneth Gonsalves wrote: > On Sun, 2011-07-10 at 14:39 +0100, Cal Le

Re: Getting a subclass from an abstract Model

2011-07-11 Thread gontran
You may be right but like I said, I will do differently: for s in MyBaseModel.__subclasses__(): if s.__name__ == "ClassA": MyClass = ClassA elif s.__name__ == "ClassB": MyClass = ClassB it was so simple!!! Thank you anyway. -- You received this message because you are

Re: ANN: django-iadmin

2011-07-11 Thread sax
should be solved in github. sax 2011/7/11 Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> > Oh and, the fix I pasted here is *somewhat* hacky, and is really just meant > to get you off the ground. The maintainer will need to patch this at a later > date though. > > Ca

Re: 'WSGIRequest' object has no attribute 'update'

2011-07-11 Thread Malcolm Box
Hi,. On 11 July 2011 08:29, Phang Mulianto wrote: > > > return render_to_response(template_name, locals(), > context_instance=(request)) > The bug is in this line. render_to_response() takes a dictionary as the context_instance, but this code just passes the request instance. You probably

Re: need help with calling following complex query

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
Thats pretty cool, I didnt know you could do create function. Will check this out later :) On 11 Jul 2011 06:06, "Venkatraman S" wrote: > On Mon, Jul 11, 2011 at 10:02 AM, sanket wrote: > >> I think I would go ahead with executing the raw SQL in this case. >> The solution by @Venatraman looks int

Re: Scaling to 30k requests (malcolm box blog)

2011-07-11 Thread Malcolm Box
Thanks for the recommendations Cal. I hope this stuff is of use to some people - let me know if anyone wants to know more. On 10 July 2011 21:06, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > Came across the following blog entries today, for those interested

Re: CSRF problem with /i18n/setlang/

2011-07-11 Thread cjwalter
Yes, the internationalization part seems to be configured ok and appears working. It is really the CSRF failure that bogging me. Apart from my current project I just created a fresh one (using Django 1.3) just to confirm the issue is not caused by possible side-effects from within my original proj

Re: my frist django project Error

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
On 11 Jul 2011 04:39, "Kenneth Gonsalves" wrote: > > On Sun, 2011-07-10 at 20:13 +0100, Cal Leeming [Simplicity Media Ltd] > wrote: > > > Telling someone they need to learn more python isn't helpful - tell > > them > > > that theres a setting missing and how the traceback makes that > > clear. > >

Re: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
On 11 Jul 2011 10:07, "i...@webbricks.co.uk" wrote: > > what about mentioning this as well? > > http://learnpythonthehardway.org/ Havent come across this before.. perhaps you could send a review to the list of your experiences with it? If anyone else in the list has used this ,could you post som

Re: RegistrationForm subclass not showing up

2011-07-11 Thread katstevens
I think that's it! I'm using v0.7 and will upgrade now - thanks for the heads up. On Jul 8, 6:52 pm, CareerDhaba tech wrote: > I believe you are using an older version of django_registration, since there > is no reference to the backend in your code. The backend is an addition in > the latest (0.

Re: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-11 Thread Kenneth Gonsalves
On Mon, 2011-07-11 at 10:44 +0100, Cal Leeming [Simplicity Media Ltd] wrote: > > http://learnpythonthehardway.org/ > > Havent come across this before.. perhaps you could send a review to > the list > of your experiences with it? the person who wrote it was quite often on #django > > If anyone el

Re: my frist django project Error

2011-07-11 Thread Kenneth Gonsalves
On Mon, 2011-07-11 at 10:40 +0100, Cal Leeming [Simplicity Media Ltd] wrote: > > > > looks like we need to add a section on how to answer questions also. > > +1 on this. started: https://code.djangoproject.com/wiki/UsingTheMailingList#Howtoanswerquestionsonthelist -- regards KG http://lawgon.li

Re: Scaling to 30k requests (malcolm box blog)

2011-07-11 Thread Roberto De Ioris
> >> The stack they have used is quite interesting. Although they are using >> Apache w/ mod_wsgi (which tends to be a lot slower than using nginx with >> uwsgi), they still seem to have got some decent performance out of it. > > > Indeed, it's on the to-do list to try comparing the performance of

Re: my frist django project Error

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
Look good (i've added 1 line). Nice work on adding the TOC, didn't know about that. Cal On Mon, Jul 11, 2011 at 11:19 AM, Kenneth Gonsalves wrote: > On Mon, 2011-07-11 at 10:40 +0100, Cal Leeming [Simplicity Media Ltd] > wrote: > > > > > > looks like we need to add a section on how to answer qu

Re: http auth using django auth_user table

2011-07-11 Thread Tom Evans
On Sun, Jul 10, 2011 at 2:30 PM, Cal Leeming [Simplicity Media Ltd] wrote: > The only connection this question has with Django, is the encryption method > that Django uses, and therefore is inappropriate for this forum. > Please refer to http://code.djangoproject.com/wiki/UsingTheMailingList > On

Re: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
Added On Sun, Jul 10, 2011 at 4:44 PM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > How about this.. > > --- > Asking question about Python related subjects is fine as long as; > > * You follow the same guidelines as the rest of this document > * The questio

Re: 'WSGIRequest' object has no attribute 'update'

2011-07-11 Thread Phang Mulianto
> > > The bug is in this line. render_to_response() takes a dictionary as the > context_instance, but this code just passes the request instance. > > You probably meant either: > > return render_to_response(template_name, locals(), > context_instance=(request, )) # Note comma > > or > > return ren

Re: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
Actually, that does look quite nice. Although I can't comment on how accurate the information is without using it myself. KG, is the site fairly accurate?? Cal On Mon, Jul 11, 2011 at 10:58 AM, Kenneth Gonsalves wrote: > On Mon, 2011-07-11 at 10:44 +0100, Cal Leeming [Simplicity Media Ltd] > wr

Re: ANN: django-iadmin

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
Nice, Can a Windows user please test and confirm: https://github.com/saxix/django-iadmin/issues/4 Thanks Cal On Mon, Jul 11, 2011 at 10:23 AM, sax wrote: > should be solved in github. > > sax > > > 2011/7/11 Cal Leeming [Simplicity Media Ltd] < > cal.leem...@simplicitymedialtd.co.uk> > > Oh

something about django mysql database long connection

2011-07-11 Thread oops
hi, Now, i am doing a django project, and use models to do all operation about data in mysql db. and i think that it would connect to database whenever do some operation like 'XXX.objects.all()' , may be it would cast much of resource on database connection. So i need a connection never being des

WindowsError 32

2011-07-11 Thread Domdom
Hello! When I try to delete file from django on windows sometimes I meet error page WindowsError 32. My model calls this method every fore every delete: def delete(self, using=None): super(UserFile, self).delete(using) self.fileobject.close() self.fileobject.storage.del

Re: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-11 Thread Kenneth Gonsalves
On Mon, 2011-07-11 at 12:05 +0100, Cal Leeming [Simplicity Media Ltd] wrote: > Actually, that does look quite nice. Although I can't comment on how > accurate the information is without using it myself. > > KG, is the site fairly accurate?? what do you mean by 'accurate'? -- regards KG http://l

trying to use the User model

2011-07-11 Thread NISA BALAKRISHNAN
I am new to django. I am trying to write a model that looks like dis. class Profile(models.Model): user = models.OneToOneField(User) birth_date = models.DateField() bio = models.TextField() address = models.CharField(max_length=100) city = models.CharField(max_length=50) st

Re: trying to use the User model

2011-07-11 Thread Kenneth Gonsalves
On Mon, 2011-07-11 at 02:15 -0700, NISA BALAKRISHNAN wrote: > when i run the server this is the error message i get . > Could not import person.views. Error was: cannot import name User at the top of your file do: from django.contrib.auth.models import User -- regards KG http://lawgon.livejourn

Re: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
On Mon, Jul 11, 2011 at 12:12 PM, Kenneth Gonsalves wrote: > On Mon, 2011-07-11 at 12:05 +0100, Cal Leeming [Simplicity Media Ltd] > wrote: > > Actually, that does look quite nice. Although I can't comment on how > > accurate the information is without using it myself. > > > > KG, is the site fair

Re: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-11 Thread Kenneth Gonsalves
On Mon, 2011-07-11 at 12:18 +0100, Cal Leeming [Simplicity Media Ltd] wrote: > > what do you mean by 'accurate'? > > > > As in, did the tutorial contain any errors / false / inaccurate > information? > I would check it myself, but haven't got any spare time at the > moment :/ It > looks very clean

Re: http auth using django auth_user table

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
On Mon, Jul 11, 2011 at 12:02 PM, Tom Evans wrote: > On Sun, Jul 10, 2011 at 2:30 PM, Cal Leeming [Simplicity Media Ltd] > wrote: > > The only connection this question has with Django, is the encryption > method > > that Django uses, and therefore is inappropriate for this forum. > > Please refer

Re: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
On Mon, Jul 11, 2011 at 12:19 PM, Kenneth Gonsalves wrote: > On Mon, 2011-07-11 at 12:18 +0100, Cal Leeming [Simplicity Media Ltd] > wrote: > > > what do you mean by 'accurate'? > > > > > > > As in, did the tutorial contain any errors / false / inaccurate > > information? > > I would check it myse

Re: something about django mysql database long connection

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
On Mon, Jul 11, 2011 at 4:49 AM, oops wrote: > hi, > Now, i am doing a django project, and use models to do all operation > about data in mysql db. > > and i think that it would connect to database whenever do some > operation like 'XXX.objects.all()' , may be it would cast much of > resource on

Re: (UsingTheMailingList) Pre-requisites for newcomers on Django

2011-07-11 Thread Eyad Al Sibai
+! -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/kIcMhIXH_ZoJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from thi

Re: trying to use the User model

2011-07-11 Thread bruno desthuilliers
On Jul 11, 11:15 am, NISA BALAKRISHNAN wrote: > I am new to django. > I am trying to write a model that looks like dis. > > class Profile(models.Model): >     user = models.OneToOneField(User) >     birth_date = models.DateField() >     bio = models.TextField() >     address = models.CharField(max

Re: RegistrationForm subclass not showing up

2011-07-11 Thread katstevens
OK I must have missed something fundamental. I installed v0.8 and having started all over again, I only made one change - adding an extra field to the basic RegistrationForm class in registration.forms - this isn't showing up on my template either! Looking over my code, I've found it's not just th

Re: WindowsError 32

2011-07-11 Thread bruno desthuilliers
On Jul 11, 7:53 am, Domdom wrote: > Hello! When I try to delete file from django on windows sometimes I > meet error page WindowsError 32. What is WindowsError 32 ? (believe it or else, but quite a few people here never use this particular OS). > My model calls this method every fore > every del

New to Django

2011-07-11 Thread Eyad Al-Sibai
Hi! I am new to Django, but I am not sure if I should use the built in Django auth for registration and authorization or I should use another app/package. Eyad -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: New to Django

2011-07-11 Thread bruno desthuilliers
On Jul 11, 2:07 pm, Eyad Al-Sibai wrote: > Hi! > > I am new to Django, but I am not sure if I should use the built in Django > auth for registration and authorization or I should use another app/package. > First learn to use django.auth, then if and when it doesn't fit your needs you'll be able t

Re: CSRF problem with /i18n/setlang/

2011-07-11 Thread cjwalter
...what shall I say: problem solved. By simply using RequestContext instead of Context. Yes, the error message said so, but I somehow assumed that this concerns the i18l code and not my view... -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: RegistrationForm subclass not showing up

2011-07-11 Thread Andre Terra
My guess is that there's another module somewhere in your PYTHONPATH from which django is importing these forms. Also, don't edit registration.forms, subclass the form instead. You can also try {{ form.as_p }} to make sure the problem isn't in the template. You can raise an exception somewhere i

Re: FormMixin missing method

2011-07-11 Thread Andre Terra
Hey, Lior Would you mind giving us an example of what you mean by setting up the instance, and why that part of the code should live in the view? It doesn't have to be production-quality code, just an example of the concept you have in mind. Cheers, André On Sat, Jul 9, 2011 at 5:18 PM, Lior Sio

Re: WindowsError 32

2011-07-11 Thread Peter Murphy
Domdom, The first thing to do is Google|Bing|Other Search Engine of your choice "WindowsError 32". If you had done that, the first link: http://msdn.microsoft.com/en-us/library/ms681382%28v=vs.85%29.aspx Would have given you a clue: ERROR_SHARING_VIOLATION 32 (0x20): The process cannot access t

speeding up iterating over query set

2011-07-11 Thread Michel30
Hi all, I have a basic search function that uses Q objects. After profiling it I found that the actual (mysql) database query finishes in fractions of seconds but the iterating after this can take up to 50 seconds per 10.000 results. I have been trying to speed it up but I have had not much resul

Re: speeding up iterating over query set

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
On Mon, Jul 11, 2011 at 2:57 PM, Michel30 wrote: > Hi all, > > I have a basic search function that uses Q objects. > After profiling it I found that the actual (mysql) database query > finishes in fractions of seconds but the iterating after this can take > up to 50 seconds per 10.000 results. >

Re: speeding up iterating over query set

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
On Mon, Jul 11, 2011 at 3:04 PM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > > > On Mon, Jul 11, 2011 at 2:57 PM, Michel30 wrote: > >> Hi all, >> >> I have a basic search function that uses Q objects. >> After profiling it I found that the actual (mysql) da

Re: speeding up iterating over query set

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
On Mon, Jul 11, 2011 at 3:06 PM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > > > On Mon, Jul 11, 2011 at 3:04 PM, Cal Leeming [Simplicity Media Ltd] < > cal.leem...@simplicitymedialtd.co.uk> wrote: > >> >> >> On Mon, Jul 11, 2011 at 2:57 PM, Michel30 wrote:

Re: speeding up iterating over query set

2011-07-11 Thread Michel30
I didn't try this approach yet, I'll give it a go and let you know my mileage. Thanks On Jul 11, 4:06 pm, "Cal Leeming [Simplicity Media Ltd]" wrote: > On Mon, Jul 11, 2011 at 3:04 PM, Cal Leeming [Simplicity Media Ltd] < > > > > cal.leem...@simplicitymedialtd.co.uk> wrote: > > > On Mon, Jul 11,

Re: speeding up iterating over query set

2011-07-11 Thread Andre Terra
You seem to be hauling the same data from one side to the other, and I can't see why. Try: MyModel.objects.values_list('id', flat=True) You can use that to build a dictionary if you add a second field, or using list comprehensions which I believe are faster than for loops, dict(MyModel.objects.

Re: RegistrationForm subclass not showing up

2011-07-11 Thread katstevens
Thank you for your help Andre - I've now worked out what the problem was. I was editing the wrong copy of the source code (it happens to everyone at some point!) so no wonder the changes were not happening... In the end I just created a completely new url path (i.e. not 'accounts/register') and cal

Re: Need help intercepting SQL

2011-07-11 Thread Eric B
> @OP: I think your better bet would be to implement your own db > backend, deriving from django's mysql backend. I agree and looked into this, but the backend in Django 1.2 actually defers to the MySQLdb library. I couldn't find any references online that talked about or showed examples for exte

Re: Need help intercepting SQL

2011-07-11 Thread Eric B
> I am taking a very wild guess, as i have not pored over the docs, > but does a middleware which proxies the sqls help you? I think > i saw one such in djangosnippets. I searched djangosnippets.org for "proxy sql" and only found http://djangosnippets.org/snippets/1913/. That's not exactly what I

Re: RegistrationForm subclass not showing up

2011-07-11 Thread Andre Terra
> > Thank you for your help Andre You're welcome! > I've now worked out what the problem > was. I was editing the wrong copy of the source code (it happens to > everyone at some point!) so no wonder the changes were not > happening... Happens to me more often than I'd like to admit... > In t

Re: Need help intercepting SQL

2011-07-11 Thread DrBloodmoney
I think that you would probably have better luck coming at it from the other end. That is, in the database itself (stored procedure or otherwise). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Brent
Thanks for the responses. How do I use a foreign key, though? In other words, how do I tell my code to look at UserProfile rather than just user? On Jul 10, 5:08 am, Jonas Geiregat wrote: > Op 10-jul-2011, om 12:37 heeft Venkatraman S het volgende geschreven: > > > > > This is not good design. I

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Michał Sawicz
Dnia 2011-07-11, pon o godzinie 09:48 -0700, Brent pisze: > How do I use a foreign key, though? In other words, how do I tell my > code to look at UserProfile rather than just user? https://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users -- Michał (Saviq) S

Re: need help with calling following complex query

2011-07-11 Thread Jonas Geiregat
> > results.extra(select={ > 'distance': > '(acos(sin(latitude)*sin(%(latitude)f)+cos(latitude)*cos(%(latitude)f)*cos(%(longitude)f-longitude)))' > % { > 'latitude': latitude, > 'longitude': longitude

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Andre Terra
Wherever you would reference a user instance, reference UserProfile.user instead If you need to find out a profile from request.user, you can use request.user.get_profile() or the longer UserProfile.objects.get(user_id= request.user.id) Cheers, André On Mon, Jul 11, 2011 at 1:48 PM, Brent wrot

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Brent
I am having trouble with this line of the tutorial: "You need to register a handler for the signal django.db.models.signals.post_save on the User model, and, in the handler, if created=True, create the associated user profile." It seems I need to edit the User model. I am confused, though, because

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Andre Terra
All you have to do is add the following code to your models.py (or any other module that gets loaded by django, for that matter): # models.py from django.db.models import signals def create_user_profile(sender, instance, created, **kwargs): if created: UserProfile.objects.create(user

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Andre Terra
Pass user.get_profile() as a template variable instead by adding it to the template context. Cheers, André On Mon, Jul 11, 2011 at 2:50 PM, Brent wrote: > Okay, thanks. This is really helpful. > > I am having trouble calling get_profile() from within my profile.html > template, though. Here is

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Brent
Okay, thanks. This is really helpful. I am having trouble calling get_profile() from within my profile.html template, though. Here is my stack trace: http://dpaste.com/566583/ I tried calling get_profile without the (), which got rid of the error, but no data showed up. On Jul 11, 10:15 am, And

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Brent
Is this done in urls.py? On Jul 11, 10:55 am, Andre Terra wrote: > Pass user.get_profile() as a template variable instead by adding it to the > template context. > > Cheers, > André > > > > > > > > On Mon, Jul 11, 2011 at 2:50 PM, Brent wrote: > > Okay, thanks. This is really helpful. > > > I am

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Andre Terra
This is done in your view: https://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-context-requestcontext Cheers On Mon, Jul 11, 2011 at 3:12 PM, Brent wrote: > Is this done in urls.py? > > On Jul 11, 10:55 am, Andre Terra wrote: > > Pass user.get_profile() as a template variabl

Django job, King of Prussia, PA, USA

2011-07-11 Thread Shawn Milochik
http://bit.ly/pAJc4N (Dice.com link) We're hiring! If you're local check it out, e-mail me with questions. Thanks, Shawn -- 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 uns

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Brent
So I need to create a custom view? (I can't use an existing view)? I was hoping to avoid diving into templates until later, after I've become a little more familiar with the python/html code. On Jul 11, 11:48 am, Andre Terra wrote: > This is done in your view: > > https://docs.djangoproject.com/e

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Brent
Sorry, I meant I was hoping to avoid diving into defining my own views until later. On Jul 11, 1:08 pm, Brent wrote: > So I need to create a custom view? (I can't use an existing view)? I > was hoping to avoid diving into templates until later, after I've > become a little more familiar with the

Re: Scaling to 30k requests (malcolm box blog)

2011-07-11 Thread Leonidas Tsampros
"Cal Leeming [Simplicity Media Ltd]" writes: > Came across the following blog entries today, for those interested in this > sort of thing: > > http://attentionshard.wordpress.com/2011/04/26/scaling-django-to-3-requests-per-second/ > > http://attentionshard.wordpress.com/2011/04/03/scaling-to-3

Django Auth

2011-07-11 Thread Gizmo
please am new to django, and am looking for something more appropriate for django auth -- 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 emai

Re: Need help intercepting SQL

2011-07-11 Thread bruno desthuilliers
On 11 juil, 16:47, Eric B wrote: > > @OP: I think your better bet would be to implement your own db > > backend, deriving from django's mysql backend. > > I agree and looked into this, but the backend in Django 1.2 actually > defers to the MySQLdb library. Of course it does - MySQLdb is the "offi

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Andre Terra
You could use a context processor, which is basically a function that adds variables to *every* template that gets called from a properly setup view. I assume the view you are using does apply context processors, and defining one is as easy as: http://stackoverflow.com/questions/3722174/django-tem

Adding errors to form after successful validation

2011-07-11 Thread Brian McKeever
I have a search form that is used by a view to search for results and then redirect to display them one at a time. If my search doesn't find any objects matching the criteria, I'd like to display a message saying so. It seems natural to add this error to the search form and redisplay it since it a

Re: Adding errors to form after successful validation

2011-07-11 Thread Andre Terra
I feel your pain, validating forms can be a PITA... Try reading through this last bit of the form validation docs: https://docs.djangoproject.com/en/dev/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other Cheers, André Terra On Mon, Jul 11, 2011 at 6:02 PM, Brian McKe

Re: Django 1.3, Apache/2.2.14, mod_wsgi/2.8 Python/2.6.5 mod_wsgi (pid=6676): Unable to get bucket brigade for request

2011-07-11 Thread Serial H.
Hello, Did you find the solution ? I have exactly the same configuration but I am using Ubuntu 10.04. Serial H. On Jun 16, 11:56 pm, chycyra wrote: > sorry for error typing: the server is Ubuntu 10.04 and i'm no using > HTTPS request > > On Jun 17, 9:14 am, Heru Eko Susanto wrote: > > > > > >

Re: speeding up iterating over query set

2011-07-11 Thread bruno desthuilliers
On 11 juil, 15:57, Michel30 wrote: > Hi all, > > I have a basic search function that uses Q objects. > After profiling it I found that the actual (mysql) database query > finishes in fractions of seconds but the iterating after this can take > up to 50 seconds per 10.000 results. > > I have been t

TransactionTestCase and Fixture Teardown

2011-07-11 Thread David Cramer
We're currently in the process of converting from unittest (pure) to Nose, and one of the issues I've noticed while doing this was that the database wasn't flushing correctly when switching from a TransactionTestCase to a TestCase. I've been digging through the code this morning, and I honestly can

Re: Extending User model with Inheritance - Attribute Error

2011-07-11 Thread Brent
Hmm...I see. How do you choose what variables are available to which view? It seems like anything I put in context_processors is available anywhere, and I'm not sure I want that. I think I am getting closer, but I am now getting a SiteProfileNotAvailable error. Here is my stack trace: http://dpa

Re: Adding errors to form after successful validation

2011-07-11 Thread Brian McKeever
I am now doing my query in the form's clean method, and it errors the way I want it to. Thank you. Although, I do feel dirty doing it this way. I feel like I should be able to append an error to the form in the view. On Jul 11, 3:04 pm, Andre Terra wrote: > I feel your pain, validating forms can

Re: Django 1.3, Apache/2.2.14, mod_wsgi/2.8 Python/2.6.5 mod_wsgi (pid=6676): Unable to get bucket brigade for request

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
Come on guys, at least make some effort to use Google :/ http://stackoverflow.com/questions/4557920/why-is-mod-wsgi-not-able-to-write-data-ioerror-failed-to-write-data http://stackoverflow.com/questions/4517397/print-statements-on-server-give-ioerror-failed-to-write-data http://forum.webfaction

Re: Django Auth

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
Hi, Please refer to http://code.djangoproject.com/wiki/UsingTheMailingList when using the mailing list in the future. To answer your question, I believe what you are looking for is: https://docs.djangoproject.com/en/dev/topics/auth/ Cal On 11/07/2011 20:45, Gizmo wrote: please am new to d

Django form validation.. does anyone else find it awkward??

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
Does anyone else find working with form validation in Django to be a bit awkward and/or tedious? I can't say exactly why I don't like it, because I don't really know myself, I just always disliked working with it. Am I being a fussy little fuzz ball, or does anyone else have this same view t

Re: need help with calling following complex query

2011-07-11 Thread sanket
Thanks @Venkatraman, I really appreciate your help. ability to create a function is pretty cool. Thanks again, sanket On Jul 11, 1:06 pm, Jonas Geiregat wrote: > > results.extra(select={ > >                             'distance': > > '(acos(sin(latitude)*sin(%(latitude)f)+cos(latitude)*cos(%(l

Problem loading admin static files

2011-07-11 Thread mf
I'm trying to upload my project to the production server but it fails to load the admin static files. settings.py: import os PROJECT_DIR = os.path.dirname(__file__) MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media') MEDIA_URL = '/media/' STATIC_ROOT ='/srv/www/antingprojects.com.ar/gobras/st

Re: Problem loading admin static files

2011-07-11 Thread Shawn Milochik
It looks like you put STATIC_ROOT in your templates where you should have used STATIC_URL. -- 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 e

Re: TransactionTestCase and Fixture Teardown

2011-07-11 Thread Ramiro Morales
On Mon, Jul 11, 2011 at 6:52 PM, David Cramer wrote: > We're currently in the process of converting from unittest (pure) to > Nose, and one of the issues I've noticed while doing this was that the > database wasn't flushing correctly when switching from a > TransactionTestCase to a TestCase. I've

Re: Django job, King of Prussia, PA, USA

2011-07-11 Thread Venkatraman S
On Tue, Jul 12, 2011 at 12:38 AM, Shawn Milochik wrote: > http://bit.ly/pAJc4N (Dice.com link) > > We're hiring! If you're local check it out, e-mail me with questions. > Do you consider remote(overseas) candidates? -- You received this message because you are subscribed to the Google Groups

Re: Django form validation.. does anyone else find it awkward??

2011-07-11 Thread Venkatraman S
On Tue, Jul 12, 2011 at 4:26 AM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > Does anyone else find working with form validation in Django to be a bit > awkward and/or tedious? > > I can't say exactly why I don't like it, because I don't really know > myself,

Re: Django Auth

2011-07-11 Thread Kiril Vladimirov
You might want to search for something that could *expand* Django Auth to the way you like it. But trust me, you don't need anything else. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.

Re: Django Auth

2011-07-11 Thread Kenneth Gonsalves
On Mon, 2011-07-11 at 12:45 -0700, Gizmo wrote: > please am new to django, and am looking for something more > appropriate for django auth what features do you want? -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ -- You received this message becaus

Re: Django job, King of Prussia, PA, USA

2011-07-11 Thread Kenneth Gonsalves
On Tue, 2011-07-12 at 07:00 +0530, Venkatraman S wrote: > On Tue, Jul 12, 2011 at 12:38 AM, Shawn Milochik > wrote: > > > http://bit.ly/pAJc4N (Dice.com link) > > > > We're hiring! If you're local check it out, e-mail me with > questions. > > > > Do you consider remote(overseas) candidates? of

get all objects that are related to current, reverse look up

2011-07-11 Thread garagefan
simply put, here's my code class ContentBlock(Orderable, Displayable): location = models.ManyToManyField(ContentBlockLocation, blank=True, null=True, help_text="list of locations to display content block") page = models.ManyToManyField(Page, blank=True, null=True, help_text="list of pages to d

Using the mailing list

2011-07-11 Thread Kenneth Gonsalves
hi, I think this deserves a thread of it's own. I have started a section on migrating from other frameworks - since I came from Zope, I have added a few points there. People from other frameworks/tools please pitch in. https://code.djangoproject.com/wiki/UsingTheMailingList#Migratingfromotherfram

request.method GET or POST

2011-07-11 Thread Venkatraman S
We have to check for request.method to suitably route the request to the logic. Would it be nice if we have something like doGet or doPost(similar to java servlets) that we have in our views, so that the request gets automatically routed , and the code is structured nicely? So a view would look l

Re: Django job, King of Prussia, PA, USA

2011-07-11 Thread Venkatraman S
On Tue, Jul 12, 2011 at 7:40 AM, Kenneth Gonsalves wrote: > On Tue, 2011-07-12 at 07:00 +0530, Venkatraman S wrote: > > On Tue, Jul 12, 2011 at 12:38 AM, Shawn Milochik > > wrote: > > > > > http://bit.ly/pAJc4N (Dice.com link) > > > > > > We're hiring! If you're local check it out, e-mail me with

Re: need help with calling following complex query

2011-07-11 Thread Venkatraman S
On Tue, Jul 12, 2011 at 4:36 AM, sanket wrote: > Thanks @Venkatraman, I really appreciate your help. > ability to create a function is pretty cool. > Thanks. Actually, i stumbled on this solution due to my use case - i test all my apps in sqlite3 and then move to other dbs; as it is easy for me

  1   2   >