django-http-proxy multiple domains support?
Is anyone on the list using the Multiple Domain (bkroeze) fork of django-http-proxy ? I've had it working fine using a single proxy domain but I am having problems getting it setup for multiple domains, due to a lack of documentation. -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
anti-join query in Django
Is there a recommended approach to anti-join queries? Here's the query I'm having an issue with: Branch.objects.filter(branchgroup__isnull=True)[:1] where branchgroup is a ManytoMany relationship to another model. I want to get a set of Branch objects that aren't mapped to any BranchGroups. This query gets translated to the following (a simplified equivalent): SELECT "scm_branch"."id" FROM "scm_branch" LEFT OUTER JOIN "scm_branchgroup_branches" ON ("scm_branch"."id" = "scm_branchgroup_branches"."branch_id") LEFT OUTER JOIN "scm_branchgroup" ON ("scm_branchgroup_branches"."branchgroup_id" = "scm_branchgroup"."id") WHERE "scm_branchgroup"."id" IS NULL LIMIT 1 This query is very slow: Limit (cost=1072479.36..6256437.79 rows=1 width=145) However, a slightly modified, but functionally equivalent query: SELECT "scm_branch"."id" FROM "scm_branch" LEFT OUTER JOIN "scm_branchgroup_branches" ON ("scm_branch"."id" = "scm_branchgroup_branches"."branch_id") LEFT OUTER JOIN "scm_branchgroup" ON ("scm_branchgroup_branches"."branchgroup_id" = "scm_branchgroup"."id") WHERE "scm_branchgroup_branches"."branch_id" IS NULL LIMIT 1 Is orders of magnitude faster: Limit (cost=1518.71..1533.35 rows=1 width=145) The difference is with the WHERE clause. Django generates WHERE "scm_branchgroup"."id" IS NULL, but a properly optimized query should use WHERE "scm_branchgroup_branches"."branch_id" IS NULL. This is because Postgres recognizes the second query as a anti-join query and can do a lot of optimization. The basic question is: How do I make Django generate a faster query? Thanks Dmitry -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: ImportError: No module named django
You can get to the python interactive interpreter by typing "python" into a Dos shell, as long as the python executable is in your system path. The IDLE command line should work, also. In the Python folder there should be a site-packages folder which contains a folder named django. The "import django" command is attempting to import from there by default. So, if that is failing, the django site package must not be installed properly. When you download the Django package as a zip file, extract it to a location. >From that location there is a setup.py file. From a shell go to that location and enter "python setup.py install". This should install the Django framework into the Python site-packages folder, and the "import django" should work from a python shell. Cheers, Furbee On Fri, Nov 18, 2011 at 12:14 PM, Jennywrote: > I am as newbie as for two hours ago I installed Python 2.7.2 and an > hour ago installed BitNami DjangoStack 1.3.1 on my Windows 7 machine. > I am trying to start with a tutorial on the Djangos website which > says: > "You can tell Django is installed by running the Python interactive > interpreter and typing import django" > > I assume that the "Python interactive interpreter" is IDLE (Python > GUI). When i run it and on the command line I write "import django", I > get a message as follwoing: > >>> import django > Traceback (most recent call last): > File " ", line 1, in >import django > ImportError: No module named django > > Would you please give me help some advice what to do here? Many thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Error with LayerMapping utility import into Postgresql 9.1
On 17.11.2011 4:32, Henry wrote: Hey All Im running through the Geodjango tutorial and am getting an error running the load.py. I get the following error; "DatabaseError: invalid byte sequence for encoding "UTF8": 0x00". It throws this error on the first row of the world borders shapefile. I can't find a null character anywhere in the first row of the shapefile. Ideas? Thanks Henry https://code.djangoproject.com/ticket/16778 -- S pozdravom / Best regards Daniel Gerzo -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Superscript in the choice list of Field.choices.
Hello all, I have a form that looks like this: MY_CHOICES = (('A', 'x^y = z'), ('B', 'y^z = x'),) class MyForm(forms.Form): my_choice_field = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple(), choices=MY_CHOICES) My question is: is it possible to display the power in superscript? That is, when outputting in HTML, it looks like xy = z yx = x. Thank you! -- 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/-/nkiSCcX1DjcJ. 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
ImportError: No module named django
I am as newbie as for two hours ago I installed Python 2.7.2 and an hour ago installed BitNami DjangoStack 1.3.1 on my Windows 7 machine. I am trying to start with a tutorial on the Djangos website which says: "You can tell Django is installed by running the Python interactive interpreter and typing import django" I assume that the "Python interactive interpreter" is IDLE (Python GUI). When i run it and on the command line I write "import django", I get a message as follwoing: >>> import django Traceback (most recent call last): File "", line 1, in import django ImportError: No module named django Would you please give me help some advice what to do here? Many thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Using Memcached on Heroku
For me worked with a snippet i've added in settings. if os.environ.get('MEMCACHE_SERVERS'): CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache', 'LOCATION': '{host}:11211'.format( host=os.environ.get('MEMCACHE_SERVERS')), 'username': os.environ.get('MEMCACHE_USERNAME'), 'password': os.environ.get('MEMCACHE_PASSWORD') } } However you can't compile pylibmc, i'm finding a way to do it. On Nov 16, 10:07 am, GuyBowdenwrote: > Hi, > > I have a django app running on Heroku - I've just added memcached to > the app and have got a server location plus username and password for > the memcached server. > > How do I put the username / password into the cache settings in my > settings.py file? I can only see the ability to put IP and Port in > there. > > Thanks, > > Guy -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Slow page load
Why are you calling os.path.join 27636 times ? These are the questions you could be asking yourself ... On Nov 18, 10:55 am, Drewrote: > I thought my code was faulty, but the admin interface is also very > slow. > It takes 8096 msec for a model with 1000 database rows to be opened > using the admin interface with debug-toolbar enabled. It is paginated > to > 100 entries per page, and SQL makes 339 queries in 128.77 msec. > I have two foreign keys on this model to models with < 20 entries > each. > > After turning on additional profiling using hotshot/debug toolbar, it > takes > 61 sec (additional profiling code being run). SQL makes 675 queries in > 297.63 msec. > > Profiling result: > > 1320805 function calls (1285639 primitive calls) in 12.122 > CPU seconds > > Ordered by: internal time, call count > List reduced from 916 to 100 due to restriction <100> > > ncalls tottime percall cumtime percall > filename:lineno(function) > 219094 2.790 0.000 3.576 0.000 /usr/lib/python2.7/ > posixpath.py:130(islink) > 206072 2.248 0.000 2.248 0.000 /usr/lib/python2.7/ > posixpath.py:60(join) > 27636/14223 1.751 0.000 8.587 0.001 /usr/lib/python2.7/ > posixpath.py:355(realpath) > 219094 0.545 0.000 0.786 0.000 /usr/lib/python2.7/ > stat.py:55(S_ISLNK) > 28294 0.494 0.000 0.494 0.000 /usr/lib/python2.7/ > posixpath.py:312(normpath) > 13413 0.343 0.000 1.108 0.000 /usr/lib/python2.7/ > posixpath.py:378(_resolve_link) > 14562 0.324 0.000 0.324 0.000 /usr/lib/python2.7/ > linecache.py:43(checkcache) > 339 0.253 0.001 8.910 0.026 /usr/lib/pymodules/ > python2.7/debug_toolbar/panels/sql.py:31(tidy_stacktrace) > 219098 0.240 0.000 0.240 0.000 /usr/lib/python2.7/ > stat.py:24(S_IFMT) > 18480/4037 0.202 0.000 0.502 0.000 /usr/lib/python2.7/ > copy.py:145(deepcopy) > 339 0.181 0.001 0.598 0.002 /usr/lib/python2.7/ > traceback.py:280(extract_stack) > 55930 0.132 0.000 0.132 0.000 /usr/lib/python2.7/ > posixpath.py:51(isabs) > 301 0.094 0.000 0.293 0.001 /usr/lib/pymodules/ > python2.7/debug_toolbar/panels/sql.py:49(get_template_info) > 15393 0.075 0.000 0.075 0.000 /usr/lib/pymodules/ > python2.7/django/utils/functional.py:274(__getattr__) > 18138 0.075 0.000 0.075 0.000 /usr/lib/python2.7/ > copy.py:267(_keep_alive) > 31585 0.072 0.000 0.072 0.000 /usr/lib/pymodules/ > python2.7/django/views/debug.py:18(linebreak_iter) > 339 0.072 0.000 10.087 0.030 /usr/lib/pymodules/ > python2.7/debug_toolbar/panels/sql.py:88(execute) > 14225 0.070 0.000 0.338 0.000 /usr/lib/python2.7/ > posixpath.py:341(abspath) > 2353/2018 0.069 0.000 0.279 0.000 /usr/lib/pymodules/ > python2.7/django/utils/tree.py:55(__deepcopy__) > 311 0.064 0.000 0.128 0.000 /usr/lib/pymodules/python2.7/ > django/template/loaders/app_directories.py:52(load_template_source) > 1009 0.060 0.000 0.585 0.001 /usr/lib/pymodules/ > python2.7/django/db/models/sql/query.py:229(clone) > 968 0.057 0.000 0.111 0.000 /usr/lib/pymodules/ > python2.7/django/db/models/base.py:273(__init__) > 14562 0.054 0.000 0.093 0.000 /usr/lib/python2.7/ > linecache.py:13(getline) > 339 0.052 0.000 0.052 0.000 /usr/lib/pymodules/ > python2.7/django/db/backends/mysql/base.py:263(_valid_connection) > 9376/8557 0.050 0.000 4.411 0.001 /usr/lib/pymodules/ > python2.7/django/utils/encoding.py:54(force_unicode) > 339 0.050 0.000 0.070 0.000 /usr/lib/pymodules/ > python2.7/MySQLdb/cursors.py:273(_do_query) > 2689/1344 0.050 0.000 0.233 0.000 /usr/lib/python2.7/ > copy.py:234(_deepcopy_tuple) > 6365 0.044 0.000 0.044 0.000 /usr/lib/python2.7/ > encodings/utf_8.py:15(decode) > 1200 0.041 0.000 10.759 0.009 /usr/lib/pymodules/ > python2.7/django/contrib/admin/templatetags/admin_list.py: > 129(items_for_result) > 932 0.037 0.000 11.203 0.012 /usr/lib/pymodules/ > python2.7/django/db/models/fields/related.py:286(__get__) > 700/100 0.033 0.000 0.108 0.001 /usr/lib/pymodules/ > python2.7/django/db/models/query.py:1144(get_cached_row) > 2713 0.030 0.000 0.032 0.000 /usr/lib/pymodules/ > python2.7/django/utils/datastructures.py:89(__init__) > 468 0.027 0.000 0.033 0.000 /usr/lib/pymodules/ > python2.7/django/db/backends/mysql/compiler.py:4(resolve_columns) > 600 0.026 0.000 0.044 0.000 /usr/lib/pymodules/ > python2.7/django/contrib/admin/util.py:321(display_for_field) > 3231 0.025 0.000 0.025 0.000 /usr/lib/pymodules/ > python2.7/django/utils/safestring.py:89(mark_safe) > 14562 0.024 0.000 0.039 0.000
Re: browser detection in django
Well if it is IE then you can do conditional commenting for IE to detect itself: css -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Extend user model multiple times
Personally I think get_profile() is an anti-pattern, just access it like any other OneToOneField (and that's what you want... not unique=True on a ForeignKey). Just set up a models.OneToOneField(User, related_name=XXX), then you can access the profile as user.XXX. The User model and all of its associated limitations are my least favorite thing about django. Hopefully, we'll get some kind of lazy loading User model that we can easily override and extend (and will still play nice with the django ecosystem) in the future. -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to trace the raw executed sql in Django
On Fri, Nov 18, 2011 at 5:18 PM, Tom Evanswrote: > On Fri, Nov 18, 2011 at 4:20 PM, Kayode Odeyemi wrote: > > Just for the sake of learning. How am I the one creating the queries? I > only > > created a model to be saved by calling save() on it. The rest is left to > > Django to handle as I can see in the traceback. Though I never saw the > sql > > (which is what I've been looking for) . > > > > py-mysqldb also doesn't create the query. It does some magic of > importing a > > MySQL C library and then doing something like db.query() on the > Connection > > subclass, with _mysql.connection as it's parent. But the exact query() > > method was never found. I just couldn't trace it. > > > I just re-read the stack trace; you're right. I misread your original > code snippet as "This is the code I'm running, and this is the stack > trace it generates", in which case DDT would work, or simply looking > in django.db.connection.queries would show you 'almost' the SQL it > sends. > > Eg, if you can reproduce it in a shell: > from django.db import connection > connection.queries[-1]['sql'] # get the last query executed > Cool! This is really very helpful. > > -- > 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. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Odeyemi 'Kayode O. http://www.sinati.com. t: @charyorde -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Select fields change their value without user interaction
Hello Noxxan, On Friday, November 18, 2011 8:57:53 AM UTC-8, Noxxan wrote: Django admin in my case is used very often, many people are using it, > and I'm wondering what can I do to catch I don't know about catching an unwanted change. How would Django be able to know that a changed value from the browser is incorrect? > reproduce this kind of > problems, to react on them, You might want to try to isolate if the issue is related to just the FK field with 2k entries in it for your browser. Perhaps create a bare minimum html file by hand with a select field with 2 k entries and see if that produces the issue. At least if the issue does manifest it would help you with where the bug is happening. By the way would the ModelAdmin.raw_id_fields < http://docs.djangoproject.com/en/1.3//ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields > be an option for your use case? Toodle-looo... creecode -- 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/-/r9wBXzLDhT8J. 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to trace the raw executed sql in Django
On Fri, Nov 18, 2011 at 4:20 PM, Kayode Odeyemiwrote: > Just for the sake of learning. How am I the one creating the queries? I only > created a model to be saved by calling save() on it. The rest is left to > Django to handle as I can see in the traceback. Though I never saw the sql > (which is what I've been looking for) . > > py-mysqldb also doesn't create the query. It does some magic of importing a > MySQL C library and then doing something like db.query() on the Connection > subclass, with _mysql.connection as it's parent. But the exact query() > method was never found. I just couldn't trace it. I just re-read the stack trace; you're right. I misread your original code snippet as "This is the code I'm running, and this is the stack trace it generates", in which case DDT would work, or simply looking in django.db.connection.queries would show you 'almost' the SQL it sends. Eg, if you can reproduce it in a shell: from django.db import connection connection.queries[-1]['sql'] # get the last query executed Or, as others have suggested, you could stick a break point on the last point before django sends the data onto py-mysqldb, in django/db/backends/mysql/base.py Cheers Tom -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Different sub-domain for each app
Hi all, I have one domain, for example, adomain.com, and one django project. I plan to have each app serve a subdomain, like blog.adomain.com served by the blog app, and catalogue.adomain.com served by the catalogue app. What's the best way of doing this? regards, Tim. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Select fields change their value without user interaction
Thanks for your answer, I also suspect browser (big tree, it happens randomly), but maybe there are other possibilities here. Django admin in my case is used very often, many people are using it, and I'm wondering what can I do to catch/reproduce this kind of problems, to react on them, because integrity of data keeped there is important for me, I would rather want to crash hole browser than save corrupt data. I'm using Django 1.2.5 in this moment, with Python 2.6.6, if it can help. -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Slow page load
On Fri, Nov 18, 2011 at 10:55 AM, Drewrote: > It takes 8096 msec for a model with 1000 database rows to be opened > using the admin interface with debug-toolbar enabled. It is paginated > to > 100 entries per page, and SQL makes 339 queries in 128.77 msec. > I have two foreign keys on this model to models with < 20 entries > each. this is a typical query explosion. it happens when you do a simple queryset, but when processing each item, it has to fetch some related object, so it's one or two extra queries per item. for example, do you use related objects in your __unicode__() method? -- Javier -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Extend user model multiple times
I'm reading up on extending the user model and planing out a project and wanted to clarify a point. I want to have a single user list to authenticate using the standard user model. I want then to create multiple apps in the project, each with roles and permissions tied to the user defined in the user model. Can I extend the user model once for each app? How would that be defined in settings.py? Also, when I deploy a new app into the existing project, how do I create the app specific user model rows to not get a null when doing get_profile()? Example: from django.db import models from django.contrib.auth.models import User class AppAUserProfile(models.Model): role = models.TextField() user = models.ForeignKey(User, unique=True) --- from django.db import models from django.contrib.auth.models import User class AppBUserProfile(models.Model): can_access = models.BooleanField() role = models.TextField() user = models.ForeignKey(User, unique=True) -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Slow page load
I thought my code was faulty, but the admin interface is also very slow. It takes 8096 msec for a model with 1000 database rows to be opened using the admin interface with debug-toolbar enabled. It is paginated to 100 entries per page, and SQL makes 339 queries in 128.77 msec. I have two foreign keys on this model to models with < 20 entries each. After turning on additional profiling using hotshot/debug toolbar, it takes 61 sec (additional profiling code being run). SQL makes 675 queries in 297.63 msec. Profiling result: 1320805 function calls (1285639 primitive calls) in 12.122 CPU seconds Ordered by: internal time, call count List reduced from 916 to 100 due to restriction <100> ncalls tottime percall cumtime percall filename:lineno(function) 2190942.7900.0003.5760.000 /usr/lib/python2.7/ posixpath.py:130(islink) 2060722.2480.0002.2480.000 /usr/lib/python2.7/ posixpath.py:60(join) 27636/142231.7510.0008.5870.001 /usr/lib/python2.7/ posixpath.py:355(realpath) 2190940.5450.0000.7860.000 /usr/lib/python2.7/ stat.py:55(S_ISLNK) 282940.4940.0000.4940.000 /usr/lib/python2.7/ posixpath.py:312(normpath) 134130.3430.0001.1080.000 /usr/lib/python2.7/ posixpath.py:378(_resolve_link) 145620.3240.0000.3240.000 /usr/lib/python2.7/ linecache.py:43(checkcache) 3390.2530.0018.9100.026 /usr/lib/pymodules/ python2.7/debug_toolbar/panels/sql.py:31(tidy_stacktrace) 2190980.2400.0000.2400.000 /usr/lib/python2.7/ stat.py:24(S_IFMT) 18480/40370.2020.0000.5020.000 /usr/lib/python2.7/ copy.py:145(deepcopy) 3390.1810.0010.5980.002 /usr/lib/python2.7/ traceback.py:280(extract_stack) 559300.1320.0000.1320.000 /usr/lib/python2.7/ posixpath.py:51(isabs) 3010.0940.0000.2930.001 /usr/lib/pymodules/ python2.7/debug_toolbar/panels/sql.py:49(get_template_info) 153930.0750.0000.0750.000 /usr/lib/pymodules/ python2.7/django/utils/functional.py:274(__getattr__) 181380.0750.0000.0750.000 /usr/lib/python2.7/ copy.py:267(_keep_alive) 315850.0720.0000.0720.000 /usr/lib/pymodules/ python2.7/django/views/debug.py:18(linebreak_iter) 3390.0720.000 10.0870.030 /usr/lib/pymodules/ python2.7/debug_toolbar/panels/sql.py:88(execute) 142250.0700.0000.3380.000 /usr/lib/python2.7/ posixpath.py:341(abspath) 2353/20180.0690.0000.2790.000 /usr/lib/pymodules/ python2.7/django/utils/tree.py:55(__deepcopy__) 3110.0640.0000.1280.000 /usr/lib/pymodules/python2.7/ django/template/loaders/app_directories.py:52(load_template_source) 10090.0600.0000.5850.001 /usr/lib/pymodules/ python2.7/django/db/models/sql/query.py:229(clone) 9680.0570.0000.1110.000 /usr/lib/pymodules/ python2.7/django/db/models/base.py:273(__init__) 145620.0540.0000.0930.000 /usr/lib/python2.7/ linecache.py:13(getline) 3390.0520.0000.0520.000 /usr/lib/pymodules/ python2.7/django/db/backends/mysql/base.py:263(_valid_connection) 9376/85570.0500.0004.4110.001 /usr/lib/pymodules/ python2.7/django/utils/encoding.py:54(force_unicode) 3390.0500.0000.0700.000 /usr/lib/pymodules/ python2.7/MySQLdb/cursors.py:273(_do_query) 2689/13440.0500.0000.2330.000 /usr/lib/python2.7/ copy.py:234(_deepcopy_tuple) 63650.0440.0000.0440.000 /usr/lib/python2.7/ encodings/utf_8.py:15(decode) 12000.0410.000 10.7590.009 /usr/lib/pymodules/ python2.7/django/contrib/admin/templatetags/admin_list.py: 129(items_for_result) 9320.0370.000 11.2030.012 /usr/lib/pymodules/ python2.7/django/db/models/fields/related.py:286(__get__) 700/1000.0330.0000.1080.001 /usr/lib/pymodules/ python2.7/django/db/models/query.py:1144(get_cached_row) 27130.0300.0000.0320.000 /usr/lib/pymodules/ python2.7/django/utils/datastructures.py:89(__init__) 4680.0270.0000.0330.000 /usr/lib/pymodules/ python2.7/django/db/backends/mysql/compiler.py:4(resolve_columns) 6000.0260.0000.0440.000 /usr/lib/pymodules/ python2.7/django/contrib/admin/util.py:321(display_for_field) 32310.0250.0000.0250.000 /usr/lib/pymodules/ python2.7/django/utils/safestring.py:89(mark_safe) 145620.0240.0000.0390.000 /usr/lib/python2.7/ linecache.py:33(getlines) 14420.0240.0000.0360.000 /usr/lib/pymodules/ python2.7/django/db/models/options.py:270(get_field) 8060.0230.000 10.6610.013 /usr/lib/pymodules/ python2.7/django/db/models/query.py:212(iterator) 252/10.0220.000 11.084 11.084 /usr/lib/pymodules/
Re: Select fields change their value without user interaction
Hello Noxxan, One possible cause. Browser bugs. I was looking at a form the other day and I saw a field with a FK popup that didn't look right. Reloaded the webpage, same thing. Looked at the record via another route and the field was OK, Reloaded form in browser again. Still wrong. Relaunched the browser, form looked OK! Let us know if a restart of the browser fixes the issue. You may want to restart the computer at well. I've found over the years that restarts can take care of all kinds of issues. I often recommend that folks get in the habit of doing regular restarts. At the start of the day is good! :-) Toodle-lo.. creecode -- 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/-/IfMxk5H5p4YJ. 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to trace the raw executed sql in Django
Thanks Tom. On Fri, Nov 18, 2011 at 2:32 PM, Tom Evanswrote: > On Fri, Nov 18, 2011 at 1:25 PM, Kayode Odeyemi wrote: > > On Fri, Nov 18, 2011 at 12:04 PM, Tom Evans > > wrote: > >> > >> On Fri, Nov 18, 2011 at 8:20 AM, Kayode Odeyemi > wrote: > >> > Hello friends, > >> > > >> > I'm having a deep Django-MySQLDB error and I'm doing some debugging to > >> > trace exactly where the problem is. It seems to me that this is very > >> > related > >> > to MySQLDB > >> > cursor implementaton. > >> > > >> > What I want to do is to run the raw sql from the interactive mode like > >> > this: > >> > > >> > import MySQLdb > >> > db=MySQLdb.connect(passwd="pass",db="dname") > >> > c=db.cursor() > >> > max_price=5 > >> > c.execute(RAW_SQL_HERE) > >> > > >> > In case you don't mind, here is the full stack trace: > >> > > >> > Traceback (most recent call last): > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\execute\trace.py" > >> > , line 36, in trace > >> > return cls(states.SUCCESS, retval=fun(*args, **kwargs)) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\task\__init__ > >> > .py", line 232, in __call__ > >> > return self.run(*args, **kwargs) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\__init__.py", > >> > line 172, in run > >> > return fun(*args, **kwargs) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\transaction.py", > >> > line 217, in inner > >> > res = func(*args, **kwargs) > >> > File "api\tasks.py", line 146, in queue_transaction > >> > txn.save() > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > >> > line 460, in save > >> > self.save_base(using=using, force_insert=force_insert, > >> > force_update=force_update) > >> > > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > >> > line 570, in save_base > >> > created=(not record_exists), raw=raw, using=using) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\dispatch\dispatcher > >> > .py", line 172, in send > >> > response = receiver(signal=self, sender=sender, **named) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode > >> > ls\managers.py", line 64, in post_save > >> > self.create_log_entry(instance, created and 'I' or 'U') > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode > >> > ls\managers.py", line 61, in create_log_entry > >> > manager.create(action_type = action_type, **attrs) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p > >> > y", line 138, in create > >> > return self.get_query_set().create(**kwargs) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" > >> > , line 360, in create > >> > obj.save(force_insert=True, using=self.db) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > >> > line 460, in save > >> > self.save_base(using=using, force_insert=force_insert, > >> > force_update=force_update) > >> > > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > >> > line 553, in save_base > >> > result = manager._insert(values, return_id=update_pk, using=using) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p > >> > y", line 195, in _insert > >> > return insert_query(self.model, values, **kwargs) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" > >> > , line 1436, in insert_query > >> > return query.get_compiler(using=using).execute_sql(return_id) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi > >> > ler.py", line 791, in execute_sql > >> > cursor = super(SQLInsertCompiler, self).execute_sql(None) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi > >> > ler.py", line 735, in execute_sql > >> > cursor.execute(sql, params) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\util.py > >> > ", line 34, in execute > >> > return self.cursor.execute(sql, params) > >> > File > >> > > >> > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\mysql\b > >> > ase.py", line 86, in execute > >> > return self.cursor.execute(query, args) > >> > File "build\bdist.win32\egg\MySQLdb\cursors.py", line 176, in execute > >> > if not self._defer_warnings: self._warning_check() > >> > File
Re: How to trace the raw executed sql in Django
>>> On Fri, Nov 18, 2011 at 8:20 AM, Kayode Odeyemiwrote: >>> > Hello friends, >>> > >>> > I'm having a deep Django-MySQLDB error and I'm doing some debugging to >>> > trace exactly where the problem is. It seems to me that this is very >>> > related >>> > to MySQLDB >>> > cursor implementaton. >>> > >>> > What I want to do is to run the raw sql from the interactive mode like >>> > this: >>> > >>> > import MySQLdb >>> > db=MySQLdb.connect(passwd="pass",db="dname") >>> > c=db.cursor() >>> > max_price=5 >>> > c.execute(RAW_SQL_HERE) Why not execute the SQL using Django, as documented here? https://docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom-sql-directly Chris -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Simplesms
Hi I looking for a example of simplesms api. Envoyé par mon BlackBerry® smartphone de Tigo -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Slow page load
If your SQL query generates a lot of data the IO handling of that could take a good amount of time to push over the network. But hard to know without having more info. -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to trace the raw executed sql in Django
Have you tried pdb? On Fri, Nov 18, 2011 at 9:32 AM, Tom Evanswrote: > On Fri, Nov 18, 2011 at 1:25 PM, Kayode Odeyemi wrote: >> On Fri, Nov 18, 2011 at 12:04 PM, Tom Evans >> wrote: >>> >>> On Fri, Nov 18, 2011 at 8:20 AM, Kayode Odeyemi wrote: >>> > Hello friends, >>> > >>> > I'm having a deep Django-MySQLDB error and I'm doing some debugging to >>> > trace exactly where the problem is. It seems to me that this is very >>> > related >>> > to MySQLDB >>> > cursor implementaton. >>> > >>> > What I want to do is to run the raw sql from the interactive mode like >>> > this: >>> > >>> > import MySQLdb >>> > db=MySQLdb.connect(passwd="pass",db="dname") >>> > c=db.cursor() >>> > max_price=5 >>> > c.execute(RAW_SQL_HERE) >>> > >>> > In case you don't mind, here is the full stack trace: >>> > >>> > Traceback (most recent call last): >>> > File >>> > >>> > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\execute\trace.py" >>> > , line 36, in trace >>> > return cls(states.SUCCESS, retval=fun(*args, **kwargs)) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\task\__init__ >>> > .py", line 232, in __call__ >>> > return self.run(*args, **kwargs) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\__init__.py", >>> > line 172, in run >>> > return fun(*args, **kwargs) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\transaction.py", >>> > line 217, in inner >>> > res = func(*args, **kwargs) >>> > File "api\tasks.py", line 146, in queue_transaction >>> > txn.save() >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", >>> > line 460, in save >>> > self.save_base(using=using, force_insert=force_insert, >>> > force_update=force_update) >>> > >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", >>> > line 570, in save_base >>> > created=(not record_exists), raw=raw, using=using) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\dispatch\dispatcher >>> > .py", line 172, in send >>> > response = receiver(signal=self, sender=sender, **named) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode >>> > ls\managers.py", line 64, in post_save >>> > self.create_log_entry(instance, created and 'I' or 'U') >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode >>> > ls\managers.py", line 61, in create_log_entry >>> > manager.create(action_type = action_type, **attrs) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p >>> > y", line 138, in create >>> > return self.get_query_set().create(**kwargs) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" >>> > , line 360, in create >>> > obj.save(force_insert=True, using=self.db) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", >>> > line 460, in save >>> > self.save_base(using=using, force_insert=force_insert, >>> > force_update=force_update) >>> > >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", >>> > line 553, in save_base >>> > result = manager._insert(values, return_id=update_pk, using=using) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p >>> > y", line 195, in _insert >>> > return insert_query(self.model, values, **kwargs) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" >>> > , line 1436, in insert_query >>> > return query.get_compiler(using=using).execute_sql(return_id) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi >>> > ler.py", line 791, in execute_sql >>> > cursor = super(SQLInsertCompiler, self).execute_sql(None) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi >>> > ler.py", line 735, in execute_sql >>> > cursor.execute(sql, params) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\util.py >>> > ", line 34, in execute >>> > return self.cursor.execute(sql, params) >>> > File >>> > >>> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\mysql\b >>> > ase.py", line 86, in execute >>> > return self.cursor.execute(query, args) >>> > File "build\bdist.win32\egg\MySQLdb\cursors.py", line 176, in execute >>> > if not self._defer_warnings: self._warning_check() >>> > File "build\bdist.win32\egg\MySQLdb\cursors.py", line 92, in >>> > _warning_check >>> > warn(w[-1], self.Warning, 3) >>> > Warning: Data truncated for column 'jno' at row 1 >>> > None >>> > >>> > >>> > Some
Select fields change their value without user interaction
Hi, I have a problem with large form in Django admin site. I have a model A with two inline models (B and C). Model B have some fields, and one of them is ForeignKey with another model (we can call it D). This field is displayed as HTML select field and have a lot of options (about 2k). I have record in model A. In it there is about 20 related records in model B, and so my HTML code has about 50k lines of code (mainly because of HTML select with model D). The problem is that sometimes (it happens yesterday first time) some of ForeignKey values in model B changes without user interaction, user changed something else in this big form and clicked "submit" button. Situation looks like that: Model B records (ID means ForeignKey ID): ID before submit -> ID after submit 1 -> 182 2 -> 700 3 -> 3 (no diff) 1 -> 182 2 -> 700 5 -> 5 6 -> 6 2 -> 700 ...etc So, some of foreign keys changes, some not. But also when in one record foreign key ID was changed to some value, in other record with the same value before, value after was changed to the same value as in other records with this "before foreign key ID". No errors was raised there, and Django logged changes in admin log that this fields was changed there (so, it looks like the user changed that fields, but I'm 100% sure that user doesnt do that). What could be a problem? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Custom admin changelist queryset
Both Bar and Foo obviously have a featured table and are somehow very common since you want them to be displayed in on list - which also makes only sense if they share the same attributes cause otherwise you would have empty columns depending on the model of the row your are showing. Maybe Bar and Foo should inherit from a common Model? To me it seems like your models are not defined well. Also, to show only items which have featured = True you can use a Filter (list_filter) in the admin and not create a special admin. cheers Ivo On Nov 18, 2011, at 15:43 , bax...@gretschpages.com wrote: >> Can you tell us what you goal here is? > > The goal is to get my combined list of featured items to a changelist > page. From there, I'll have additional work to do, but step one is > getting it to the page at all. > > Another thought is to just chain the querysets together and send 'em > to my own template. It would look like part of the admin, but not > actually be part of the admin. Problem there, of course, is that if I > wanted actions, list display, or any other admin-y goodness, I'd be > out of luck, I think. > > >>> I'm trying to combine a subset of two models and pass them to an admin >>> change list: >> >>> class FeaturedItemsAdmin(admin.ModelAdmin): >>> def queryset(self, request): >>> qs1 = Foo.objects.filter(featured=True) >>> qs2 = Bar.objects.filter(featured=True) >>> . do stuff to combine ... >>> return combined >> >>> I can return qs1 or qs2 to the admin, no problem. But I can't put them >>> together in a way the admin will accept. >> >>> First thing I tried was a simple itertools.chain. I've also tried >>> building a custom queryset (http://djangosnippets.org/snippets/1933/) >>> and subclassing queryset. At best, I get nothing, but most times I >>> get: >> >>> "Database error >>> Something's wrong with your database installation. Make sure the >>> appropriate database tables have been created, and make sure the >>> database is readable by the appropriate user." >> >>> Which I've tracked down to a IncorrectLookupParameters exception in >>> contrib.admin.options, but that doesn't really help me figure out what >>> it is the admin wants that I'm not giving it. >> >>> -- >>> 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. >>> For more options, visit this group >>> athttp://groups.google.com/group/django-users?hl=en. > > -- > 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. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Slow page load
I think it depends on what you are doing, more details could be helpful, are you doing any kind of processing on the view? such as processing/iterating data returned by a db query, is the server under load?, do you have users concurrently fetching the page while you check it (for example under production environment)? Regards, Carlos Daniel Ruvalcaba Valezuela -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Slow page load
Am 18.11.2011 15:32, schrieb Dre: Hi, Please help me debug a very slow page load using mod_wsgi. I installed django-debug-toolbar and got the following results: ResourceValue User CPU time 1152.072 msec System CPU time 56.004 msec Total CPU time 1208.076 msec Elapsed time1214.114 msec Context switches29 voluntary, 142 involuntary ...while SQL queries says 30 queries in 11.54 msec, so I guess SQL isn't the bottleneck. Could it still be SQL related? my wsgi configuration: WSGIDaemonProcess user processes=2 maximum-requests=500 threads=15 I tried further profiling adding Python's hotshot to debug-toolbar (according to http://backslashn.com/post/505601626/) but I got too much details and can't seem to figure out what to make of it) Any hints or suggestions would be highly appreciated. The SQL entry of the debug toolbar has a timeline. Maybe this helps you to narrow down the part which is slow. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Custom admin changelist queryset
> Can you tell us what you goal here is? The goal is to get my combined list of featured items to a changelist page. From there, I'll have additional work to do, but step one is getting it to the page at all. Another thought is to just chain the querysets together and send 'em to my own template. It would look like part of the admin, but not actually be part of the admin. Problem there, of course, is that if I wanted actions, list display, or any other admin-y goodness, I'd be out of luck, I think. > > I'm trying to combine a subset of two models and pass them to an admin > > change list: > > > class FeaturedItemsAdmin(admin.ModelAdmin): > > def queryset(self, request): > > qs1 = Foo.objects.filter(featured=True) > > qs2 = Bar.objects.filter(featured=True) > > . do stuff to combine ... > > return combined > > > I can return qs1 or qs2 to the admin, no problem. But I can't put them > > together in a way the admin will accept. > > > First thing I tried was a simple itertools.chain. I've also tried > > building a custom queryset (http://djangosnippets.org/snippets/1933/) > > and subclassing queryset. At best, I get nothing, but most times I > > get: > > > "Database error > > Something's wrong with your database installation. Make sure the > > appropriate database tables have been created, and make sure the > > database is readable by the appropriate user." > > > Which I've tracked down to a IncorrectLookupParameters exception in > > contrib.admin.options, but that doesn't really help me figure out what > > it is the admin wants that I'm not giving it. > > > -- > > 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. > > For more options, visit this group > > athttp://groups.google.com/group/django-users?hl=en. -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Slow page load
Hi, Please help me debug a very slow page load using mod_wsgi. I installed django-debug-toolbar and got the following results: ResourceValue User CPU time 1152.072 msec System CPU time 56.004 msec Total CPU time 1208.076 msec Elapsed time1214.114 msec Context switches29 voluntary, 142 involuntary ...while SQL queries says 30 queries in 11.54 msec, so I guess SQL isn't the bottleneck. Could it still be SQL related? my wsgi configuration: WSGIDaemonProcess user processes=2 maximum-requests=500 threads=15 I tried further profiling adding Python's hotshot to debug-toolbar (according to http://backslashn.com/post/505601626/) but I got too much details and can't seem to figure out what to make of it) Any hints or suggestions would be highly appreciated. Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to trace the raw executed sql in Django
On Fri, Nov 18, 2011 at 1:25 PM, Kayode Odeyemiwrote: > On Fri, Nov 18, 2011 at 12:04 PM, Tom Evans > wrote: >> >> On Fri, Nov 18, 2011 at 8:20 AM, Kayode Odeyemi wrote: >> > Hello friends, >> > >> > I'm having a deep Django-MySQLDB error and I'm doing some debugging to >> > trace exactly where the problem is. It seems to me that this is very >> > related >> > to MySQLDB >> > cursor implementaton. >> > >> > What I want to do is to run the raw sql from the interactive mode like >> > this: >> > >> > import MySQLdb >> > db=MySQLdb.connect(passwd="pass",db="dname") >> > c=db.cursor() >> > max_price=5 >> > c.execute(RAW_SQL_HERE) >> > >> > In case you don't mind, here is the full stack trace: >> > >> > Traceback (most recent call last): >> > File >> > >> > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\execute\trace.py" >> > , line 36, in trace >> > return cls(states.SUCCESS, retval=fun(*args, **kwargs)) >> > File >> > >> > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\task\__init__ >> > .py", line 232, in __call__ >> > return self.run(*args, **kwargs) >> > File >> > >> > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\__init__.py", >> > line 172, in run >> > return fun(*args, **kwargs) >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\transaction.py", >> > line 217, in inner >> > res = func(*args, **kwargs) >> > File "api\tasks.py", line 146, in queue_transaction >> > txn.save() >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", >> > line 460, in save >> > self.save_base(using=using, force_insert=force_insert, >> > force_update=force_update) >> > >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", >> > line 570, in save_base >> > created=(not record_exists), raw=raw, using=using) >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\dispatch\dispatcher >> > .py", line 172, in send >> > response = receiver(signal=self, sender=sender, **named) >> > File >> > >> > "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode >> > ls\managers.py", line 64, in post_save >> > self.create_log_entry(instance, created and 'I' or 'U') >> > File >> > >> > "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode >> > ls\managers.py", line 61, in create_log_entry >> > manager.create(action_type = action_type, **attrs) >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p >> > y", line 138, in create >> > return self.get_query_set().create(**kwargs) >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" >> > , line 360, in create >> > obj.save(force_insert=True, using=self.db) >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", >> > line 460, in save >> > self.save_base(using=using, force_insert=force_insert, >> > force_update=force_update) >> > >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", >> > line 553, in save_base >> > result = manager._insert(values, return_id=update_pk, using=using) >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p >> > y", line 195, in _insert >> > return insert_query(self.model, values, **kwargs) >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" >> > , line 1436, in insert_query >> > return query.get_compiler(using=using).execute_sql(return_id) >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi >> > ler.py", line 791, in execute_sql >> > cursor = super(SQLInsertCompiler, self).execute_sql(None) >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi >> > ler.py", line 735, in execute_sql >> > cursor.execute(sql, params) >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\util.py >> > ", line 34, in execute >> > return self.cursor.execute(sql, params) >> > File >> > >> > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\mysql\b >> > ase.py", line 86, in execute >> > return self.cursor.execute(query, args) >> > File "build\bdist.win32\egg\MySQLdb\cursors.py", line 176, in execute >> > if not self._defer_warnings: self._warning_check() >> > File "build\bdist.win32\egg\MySQLdb\cursors.py", line 92, in >> > _warning_check >> > warn(w[-1], self.Warning, 3) >> > Warning: Data truncated for column 'jno' at row 1 >> > None >> > >> > >> > Some of the solutions I found on the internet such as changing teh >> > default >> > character set >> > to utf8 has been done. I also consulted MySQL doc ref by changing the >> > sql_mode to >> > TRADITIONA both at session and global level,
Re: How to trace the raw executed sql in Django
On Fri, Nov 18, 2011 at 12:04 PM, Tom Evanswrote: > On Fri, Nov 18, 2011 at 8:20 AM, Kayode Odeyemi wrote: > > Hello friends, > > > > I'm having a deep Django-MySQLDB error and I'm doing some debugging to > > trace exactly where the problem is. It seems to me that this is very > related > > to MySQLDB > > cursor implementaton. > > > > What I want to do is to run the raw sql from the interactive mode like > this: > > > > import MySQLdb > > db=MySQLdb.connect(passwd="pass",db="dname") > > c=db.cursor() > > max_price=5 > > c.execute(RAW_SQL_HERE) > > > > In case you don't mind, here is the full stack trace: > > > > Traceback (most recent call last): > > File > > > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\execute\trace.py" > > , line 36, in trace > > return cls(states.SUCCESS, retval=fun(*args, **kwargs)) > > File > > > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\task\__init__ > > .py", line 232, in __call__ > > return self.run(*args, **kwargs) > > File > > > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\__init__.py", > > line 172, in run > > return fun(*args, **kwargs) > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\transaction.py", > > line 217, in inner > > res = func(*args, **kwargs) > > File "api\tasks.py", line 146, in queue_transaction > > txn.save() > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > > line 460, in save > > self.save_base(using=using, force_insert=force_insert, > > force_update=force_update) > > > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > > line 570, in save_base > > created=(not record_exists), raw=raw, using=using) > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\dispatch\dispatcher > > .py", line 172, in send > > response = receiver(signal=self, sender=sender, **named) > > File > > > "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode > > ls\managers.py", line 64, in post_save > > self.create_log_entry(instance, created and 'I' or 'U') > > File > > > "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode > > ls\managers.py", line 61, in create_log_entry > > manager.create(action_type = action_type, **attrs) > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p > > y", line 138, in create > > return self.get_query_set().create(**kwargs) > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" > > , line 360, in create > > obj.save(force_insert=True, using=self.db) > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > > line 460, in save > > self.save_base(using=using, force_insert=force_insert, > > force_update=force_update) > > > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > > line 553, in save_base > > result = manager._insert(values, return_id=update_pk, using=using) > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p > > y", line 195, in _insert > > return insert_query(self.model, values, **kwargs) > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" > > , line 1436, in insert_query > > return query.get_compiler(using=using).execute_sql(return_id) > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi > > ler.py", line 791, in execute_sql > > cursor = super(SQLInsertCompiler, self).execute_sql(None) > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi > > ler.py", line 735, in execute_sql > > cursor.execute(sql, params) > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\util.py > > ", line 34, in execute > > return self.cursor.execute(sql, params) > > File > > > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\mysql\b > > ase.py", line 86, in execute > > return self.cursor.execute(query, args) > > File "build\bdist.win32\egg\MySQLdb\cursors.py", line 176, in execute > > if not self._defer_warnings: self._warning_check() > > File "build\bdist.win32\egg\MySQLdb\cursors.py", line 92, in > _warning_check > > warn(w[-1], self.Warning, 3) > > Warning: Data truncated for column 'jno' at row 1 > > None > > > > > > Some of the solutions I found on the internet such as changing teh > default > > character set > > to utf8 has been done. I also consulted MySQL doc ref by changing the > > sql_mode to > > TRADITIONA both at session and global level, as well as in settings.py. > > Still no luck. > > > > Please how do I get the raw SQL executed by Django? > > > > Any help will be appreciated. > > > > Your SQL query, which you didn't show, is inserting data into a DB > table, whose definition you didn't show. The
Re: Deploy Django to hostmonster
Check out www.ep.io On Fri, Nov 18, 2011 at 6:26 AM, Tran Bac Sonwrote: > Hello, > I'm new in Django. I had write my own website by Django but I got problems > in deploying it to hostmonster. > The detail of my problem is: > http://stackoverflow.com/questions/8156173/django-cant-run-in-hostmonster > Please help me to point out what wrong. > > Many thanks > > tbson > > -- > 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. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to trace the raw executed sql in Django
On Fri, Nov 18, 2011 at 8:20 AM, Kayode Odeyemiwrote: > Hello friends, > > I'm having a deep Django-MySQLDB error and I'm doing some debugging to > trace exactly where the problem is. It seems to me that this is very related > to MySQLDB > cursor implementaton. > > What I want to do is to run the raw sql from the interactive mode like this: > > import MySQLdb > db=MySQLdb.connect(passwd="pass",db="dname") > c=db.cursor() > max_price=5 > c.execute(RAW_SQL_HERE) > > In case you don't mind, here is the full stack trace: > > Traceback (most recent call last): > File > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\execute\trace.py" > , line 36, in trace > return cls(states.SUCCESS, retval=fun(*args, **kwargs)) > File > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\task\__init__ > .py", line 232, in __call__ > return self.run(*args, **kwargs) > File > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\__init__.py", > line 172, in run > return fun(*args, **kwargs) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\transaction.py", > line 217, in inner > res = func(*args, **kwargs) > File "api\tasks.py", line 146, in queue_transaction > txn.save() > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > line 460, in save > self.save_base(using=using, force_insert=force_insert, > force_update=force_update) > > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > line 570, in save_base > created=(not record_exists), raw=raw, using=using) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\dispatch\dispatcher > .py", line 172, in send > response = receiver(signal=self, sender=sender, **named) > File > "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode > ls\managers.py", line 64, in post_save > self.create_log_entry(instance, created and 'I' or 'U') > File > "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode > ls\managers.py", line 61, in create_log_entry > manager.create(action_type = action_type, **attrs) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p > y", line 138, in create > return self.get_query_set().create(**kwargs) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" > , line 360, in create > obj.save(force_insert=True, using=self.db) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > line 460, in save > self.save_base(using=using, force_insert=force_insert, > force_update=force_update) > > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > line 553, in save_base > result = manager._insert(values, return_id=update_pk, using=using) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p > y", line 195, in _insert > return insert_query(self.model, values, **kwargs) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" > , line 1436, in insert_query > return query.get_compiler(using=using).execute_sql(return_id) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi > ler.py", line 791, in execute_sql > cursor = super(SQLInsertCompiler, self).execute_sql(None) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi > ler.py", line 735, in execute_sql > cursor.execute(sql, params) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\util.py > ", line 34, in execute > return self.cursor.execute(sql, params) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\mysql\b > ase.py", line 86, in execute > return self.cursor.execute(query, args) > File "build\bdist.win32\egg\MySQLdb\cursors.py", line 176, in execute > if not self._defer_warnings: self._warning_check() > File "build\bdist.win32\egg\MySQLdb\cursors.py", line 92, in _warning_check > warn(w[-1], self.Warning, 3) > Warning: Data truncated for column 'jno' at row 1 > None > > > Some of the solutions I found on the internet such as changing teh default > character set > to utf8 has been done. I also consulted MySQL doc ref by changing the > sql_mode to > TRADITIONA both at session and global level, as well as in settings.py. > Still no luck. > > Please how do I get the raw SQL executed by Django? > > Any help will be appreciated. > Your SQL query, which you didn't show, is inserting data into a DB table, whose definition you didn't show. The data it is inserting in, which you didn't show, is getting truncated in the 'jno' column. This is raised as an exception, since you set sql_mode to TRADITIONAL and/or run in DEBUG mode, which makes django configure Database.Warning as errors. Django doesn't execute the query, you are executing it on the raw DB cursor, so it will not be logged (certainly not by
Re: How to trace the raw executed sql in Django
You can use the django-debug-toolbar for this: https://github.com/robhudson/django-debug-toolbar On Nov 18, 2:20 am, Kayode Odeyemiwrote: > Hello friends, > > I'm having a deep Django-MySQLDB error and I'm doing some debugging to > trace exactly where the problem is. It seems to me that this is very > related to MySQLDB > cursor implementaton. > > What I want to do is to run the raw sql from the interactive mode like this: > > import MySQLdb > db=MySQLdb.connect(passwd="pass",db="dname") > c=db.cursor() > max_price=5 > c.execute(RAW_SQL_HERE) > > In case you don't mind, here is the full stack trace: > > Traceback (most recent call last): > File > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\execute\trace.py" > , line 36, in trace > return cls(states.SUCCESS, retval=fun(*args, **kwargs)) > File > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\task\__init__ > .py", line 232, in __call__ > return self.run(*args, **kwargs) > File > "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\__init__.py", > line 172, in run > return fun(*args, **kwargs) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\transaction.py", > line 217, in inner > res = func(*args, **kwargs) > File "api\tasks.py", line 146, in queue_transaction > txn.save() > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > line 460, in save > self.save_base(using=using, force_insert=force_insert, > force_update=force_update) > > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > line 570, in save_base > created=(not record_exists), raw=raw, using=using) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\dispatch\dispatcher > .py", line 172, in send > response = receiver(signal=self, sender=sender, **named) > File > "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode > ls\managers.py", line 64, in post_save > self.create_log_entry(instance, created and 'I' or 'U') > File > "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode > ls\managers.py", line 61, in create_log_entry > manager.create(action_type = action_type, **attrs) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p > y", line 138, in create > return self.get_query_set().create(**kwargs) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" > , line 360, in create > obj.save(force_insert=True, using=self.db) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > line 460, in save > self.save_base(using=using, force_insert=force_insert, > force_update=force_update) > > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", > line 553, in save_base > result = manager._insert(values, return_id=update_pk, using=using) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p > y", line 195, in _insert > return insert_query(self.model, values, **kwargs) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" > , line 1436, in insert_query > return query.get_compiler(using=using).execute_sql(return_id) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi > ler.py", line 791, in execute_sql > cursor = super(SQLInsertCompiler, self).execute_sql(None) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi > ler.py", line 735, in execute_sql > cursor.execute(sql, params) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\util.py > ", line 34, in execute > return self.cursor.execute(sql, params) > File > "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\mysql\b > ase.py", line 86, in execute > return self.cursor.execute(query, args) > File "build\bdist.win32\egg\MySQLdb\cursors.py", line 176, in execute > if not self._defer_warnings: self._warning_check() > File "build\bdist.win32\egg\MySQLdb\cursors.py", line 92, in _warning_check > warn(w[-1], self.Warning, 3) > Warning: Data truncated for column 'jno' at row 1 > None > > Some of the solutions I found on the internet such as changing teh default > character set > to utf8 has been done. I also consulted MySQL doc ref by changing the > sql_mode to > TRADITIONA both at session and global level, as well as in settings.py. > Still no luck. > > Please how do I get the raw SQL executed by Django? > > Any help will be appreciated. > > -- > Odeyemi 'Kayode O.http://www.sinati.com. t: @charyorde -- 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. For more options, visit this group at
Django SOAP/WSDL and PowerShell
Hello, Not sure if anyone here has played around with SOAP and WSDL or PowerShell for that matter. I am using the following Django snippet to enable SOAP and WSDL using Django: http://djangosnippets.org/snippets/2210/ It runs and generates a WSDL document, I also used the example located here to test as wel: https://github.com/soaplib/soaplib/blob/1_0/doc/source/pages/helloworld.rst This one is not Django specific, but rather Python. Now in PowerShell, I use the New-WebServiceProxy Cmdlet to access the SOAP web service using WSDL: $hello = New-WebServiceProxy -Uri http://localhost:7789/?wsdl PowerShell loads it in, the problem occurs when I attempt to call the say_hello function: $hello.say_hello("Kevin",5) It shoots back this error: Cannot find an overload for "say_hello" and the argument count: "2". At line:1 char:17 + $hello.say_hello ("Kevin",5) + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : MethodCountCouldNotFindBest Oddly if I inspect the method in PowerShell, it is not being seen as 2 parameters, only a single parameter, which is not even a type PowerShell can use... An example of a working WSDL document and service with PowerShell can be found here: http://www.webservicex.net/uszip.asmx?WSDL This one sees the first parameter as a String type in PowerShell and works as expected. However, PowerShell fails to work with the autogenerated WSDL document from the soaplib. Any ideas? At this point, I am very tempted on manually creating the WSDL document, but this will become more work than it has to be when I begin adding new functions to be accessed from PowerShell. I'd rather the process be automated. Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Simple admin filter
I need to filter a class (with list_filter) to get all objects with "myfield" (a date field) with month = january Instead of using a complex custom filter, i would like to create a simple filter to link to the following url: /admin/myobject/myfield__month=1 How would i do that? Do i have to create filters.py or something like that? Or can i just link to the url above? Thanks in advance -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to trace the raw executed sql in Django
Hello friends, I'm having a deep Django-MySQLDB error and I'm doing some debugging to trace exactly where the problem is. It seems to me that this is very related to MySQLDB cursor implementaton. What I want to do is to run the raw sql from the interactive mode like this: import MySQLdb db=MySQLdb.connect(passwd="pass",db="dname") c=db.cursor() max_price=5 c.execute(RAW_SQL_HERE) In case you don't mind, here is the full stack trace: Traceback (most recent call last): File "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\execute\trace.py" , line 36, in trace return cls(states.SUCCESS, retval=fun(*args, **kwargs)) File "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\task\__init__ .py", line 232, in __call__ return self.run(*args, **kwargs) File "C:\Python27\lib\site-packages\celery-2.3.2-py2.7.egg\celery\app\__init__.py", line 172, in run return fun(*args, **kwargs) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\transaction.py", line 217, in inner res = func(*args, **kwargs) File "api\tasks.py", line 146, in queue_transaction txn.save() File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", line 460, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", line 570, in save_base created=(not record_exists), raw=raw, using=using) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\dispatch\dispatcher .py", line 172, in send response = receiver(signal=self, sender=sender, **named) File "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode ls\managers.py", line 64, in post_save self.create_log_entry(instance, created and 'I' or 'U') File "C:\Python27\lib\site-packages\django_audit_log-0.2.2-py2.7.egg\audit_log\mode ls\managers.py", line 61, in create_log_entry manager.create(action_type = action_type, **attrs) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p y", line 138, in create return self.get_query_set().create(**kwargs) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" , line 360, in create obj.save(force_insert=True, using=self.db) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", line 460, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\base.py", line 553, in save_base result = manager._insert(values, return_id=update_pk, using=using) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\manager.p y", line 195, in _insert return insert_query(self.model, values, **kwargs) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\query.py" , line 1436, in insert_query return query.get_compiler(using=using).execute_sql(return_id) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi ler.py", line 791, in execute_sql cursor = super(SQLInsertCompiler, self).execute_sql(None) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\models\sql\compi ler.py", line 735, in execute_sql cursor.execute(sql, params) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\util.py ", line 34, in execute return self.cursor.execute(sql, params) File "C:\Python27\lib\site-packages\django-1.3-py2.7.egg\django\db\backends\mysql\b ase.py", line 86, in execute return self.cursor.execute(query, args) File "build\bdist.win32\egg\MySQLdb\cursors.py", line 176, in execute if not self._defer_warnings: self._warning_check() File "build\bdist.win32\egg\MySQLdb\cursors.py", line 92, in _warning_check warn(w[-1], self.Warning, 3) Warning: Data truncated for column 'jno' at row 1 None Some of the solutions I found on the internet such as changing teh default character set to utf8 has been done. I also consulted MySQL doc ref by changing the sql_mode to TRADITIONA both at session and global level, as well as in settings.py. Still no luck. Please how do I get the raw SQL executed by Django? Any help will be appreciated. -- Odeyemi 'Kayode O. http://www.sinati.com. t: @charyorde -- 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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.