Re: Postgresql Index & expensive queries [n00bie alert]

2012-10-19 Thread Sam Lai
gt; Here is the template: [3] http://dpaste.org/vxRs4/ > > Here is the 'guts' of the view: [4] http://dpaste.org/w0b2z/ > > Total Postgresql/SQL n00b, so this may be a stupid statement. I'm wondering > if an index on '"press_page"."article_id"&#

Postgresql Index & expensive queries [n00bie alert]

2012-10-19 Thread Barry Morrison
x27; of the view: [4] http://dpaste.org/w0b2z/ Total Postgresql/SQL n00b, so this may be a stupid statement. I'm wondering if an index on '"press_page"."article_id"' wouldn't speed things up a bit? In dev, I don't have the amount of data that exi

Django Admin - Index of Entry Being Edited

2012-07-13 Thread lubos
Hello, I need a way of getting index of the table entry which is being currently edited. I think that digging this from url would be the best, as I may need it anywhere in admin.py. How could I do it? Thank you in advance for any suggestion, Lubos -- You received this message because you

Re: Error with Views on Admin and Index page

2012-05-27 Thread aron.s...@gmail.com
- Reply message - From: "Peter of the Norse" Date: Sun, May 27, 2012 9:53 am Subject: Error with Views on Admin and Index page To: Can we see your urls.py? I'm worried that you’re directing to a views.py file that doesn't actually exist. On May 24, 2012, at 2

Re: Error with Views on Admin and Index page

2012-05-27 Thread aron.s...@gmail.com
W.11 - Reply message - From: "Peter of the Norse" Date: Sun, May 27, 2012 9:53 am Subject: Error with Views on Admin and Index page To: Can we see your urls.py? I'm worried that you’re directing to a views.py file that doesn't actually exist. On May 24, 2012, at 2

Re: Error with Views on Admin and Index page

2012-05-27 Thread Peter of the Norse
2009 using Django 1.1. ('m > using Django 1.3). I did set up Staticfiles (the Django 1.3 way, the > best I could as a newbie, following djangoproject directions) but > staticfiles is of course for static pages...I did create a page with > base.html and css, and was able to view

Re: Error with Views on Admin and Index page

2012-05-24 Thread cat123
ections) but > > staticfiles is of course for static pages...I did create a page with > > base.html and css, and was able to view that.  Are Admin pages and the > > Index page considered staticfiles? If so, maybe I didn't set that up > > right? > > > On May 24,

Re: Error with Views on Admin and Index page

2012-05-24 Thread Apokalyptica Painkiller
id set up Staticfiles (the Django 1.3 way, the > best I could as a newbie, following djangoproject directions) but > staticfiles is of course for static pages...I did create a page with > base.html and css, and was able to view that. Are Admin pages and the > Index page considered

Re: Error with Views on Admin and Index page

2012-05-24 Thread cat123
es is of course for static pages...I did create a page with base.html and css, and was able to view that. Are Admin pages and the Index page considered staticfiles? If so, maybe I didn't set that up right? On May 24, 1:14 pm, Apokalyptica Painkiller wrote: > Are you doing django's t

Re: Error with Views on Admin and Index page

2012-05-24 Thread Apokalyptica Painkiller
n, I > > > got a message saying: > > > > > TemplateSyntaxError at /admin/ > > > Caught ViewDoesNotExist while rendering. Could not import views. Error > > > was: No module named views. > > > > > I noticed I also get something similar after I u

Re: Error with Views on Admin and Index page

2012-05-24 Thread cat123
ogged in, instead of going to the admin screen, I > > got a message saying: > > > TemplateSyntaxError at /admin/ > > Caught ViewDoesNotExist while rendering. Could not import views. Error > > was: No module named views. > > > I noticed I also get somethi

Re: Error with Views on Admin and Index page

2012-05-24 Thread Apokalyptica Painkiller
axError at /admin/ > Caught ViewDoesNotExist while rendering. Could not import views. Error > was: No module named views. > > I noticed I also get something similar after I uncommented the django- > supplied index page (in urls.py) (which I have also never > resolved...seems they

Error with Views on Admin and Index page

2012-05-24 Thread cat123
message saying: TemplateSyntaxError at /admin/ Caught ViewDoesNotExist while rendering. Could not import views. Error was: No module named views. I noticed I also get something similar after I uncommented the django- supplied index page (in urls.py) (which I have also never resolved...seems they m

Re: Help using index view to render registration form from registration app

2012-01-31 Thread Jenna Pullen
Hi Dennis, thanks for the reply. The index / root of my site will contain the registration page for new users to sign up and contain a login page for people who are already registered to log in. so yes i would want this functionality on the default page and not have to redirect to a specific

Help using index view to render registration form from registration app

2012-01-31 Thread richard
Hi if anyone could point me in the right direction it would be greatly appreciated. Basically i have my index view which renders to index.html the main page for a site. I need to know the best practice to have my index view contain the registration form from django the registration app so when the

Changing the index page

2012-01-10 Thread kalyan boga
Hi, I was working on tutorial 2 and i tried to change the layout of index page. Copied the index.html template to my template folder under admin and changed the contents to suit the site. The second line errors out : {% load i18n admin_static %} The error on the page reads : TemplateSyntaxError

Re: Accessing Model Property from Admin Index Page

2011-11-22 Thread Daniel Roseman
On Tuesday, 22 November 2011 22:32:04 UTC, Lee wrote: > > DR - thanks for your reply. I need to display the model method result > (property) on index.html. Our index.html is heavily customized, and is > currently just a switchboard into the database tables via links like > this: > > {{ app_list.1.m

Re: Accessing Model Property from Admin Index Page

2011-11-22 Thread creecode
Hello Lee, I think what we are trying to get to is when you say index page are you talking about the admin page that lists the apps and their databases or are you talking about the change list for a particular database. If it's the latter then you might be able to do something wit

Re: Accessing Model Property from Admin Index Page

2011-11-22 Thread Lee
DR - thanks for your reply. I need to display the model method result (property) on index.html. Our index.html is heavily customized, and is currently just a switchboard into the database tables via links like this: {{ app_list.1.models.21.admin_url }} I'm hoping for a similarly simple way to sho

Re: Accessing Model Property from Admin Index Page

2011-11-22 Thread Daniel Roseman
Model(models.Model) > ... >def get_my_property(self): > return '1234' >my_property = property(get_my_property) > > Now I want to display this property on the index page in a {{ }} > variable tag. What is the correct syntax, and where can I find this in > the docs

Accessing Model Property from Admin Index Page

2011-11-21 Thread Lee
erty(get_my_property) Now I want to display this property on the index page in a {{ }} variable tag. What is the correct syntax, and where can I find this in the docs? Thanks very much for any help. Lee -- You received this message because you are subscribed to the Google Groups "Django

Re: Extending admin's index view

2011-09-07 Thread Иван Иванов
So... На Fri, 2 Sep 2011 10:24:03 +0300 Ivan Ivanov написа: > Hallo everybody! > > I've got problem exteding the admin's index view. I need to pass > extra_context to the index of the admin, after the administrator > logged in, that's why I'm trying to extend

Extending admin's index view

2011-09-02 Thread Ivan Ivanov
Hallo everybody! I've got problem exteding the admin's index view. I need to pass extra_context to the index of the admin, after the administrator logged in, that's why I'm trying to extend the view. So... What I've got is: In the root of the project I modifi

Re: using reverse to find the index-page of an app?

2011-05-08 Thread Karen Tracey
On Sun, May 8, 2011 at 6:42 AM, Thomas Weholt wrote: > I've read > http://docs.djangoproject.com/en/dev/ref/contrib/admin/#reversing-admin-urls > , > but cannot for the life of me find a way to use reverse to get the url > of the index page for my app. > > The index p

using reverse to find the index-page of an app?

2011-05-08 Thread Thomas Weholt
I've read http://docs.djangoproject.com/en/dev/ref/contrib/admin/#reversing-admin-urls, but cannot for the life of me find a way to use reverse to get the url of the index page for my app. Say my app is called "polls" ( for some strange reason ) and I want to redirect to the app

weird error on admin index

2011-04-27 Thread Pascal Moutia
Hi django users I'm trying to start my admin section of my django site but i always got an error apparently with the admin template, but i never touched it, there is the error: TemplateSyntaxError at /admin/ Caught AttributeError while rendering: 'ListView' object has no attribute 'rindex'

Re: Django view in admin index.

2011-04-26 Thread Oleg Lomaka
Not clearly understand what do you need. If you want to modify Admin index page to add your action links or widgets, take a look at django-grappelli or django-admin-tools. If you want to add custom view for your models, then read this http://docs.djangoproject.com/en/dev/ref/contrib/admin

Django view in admin index.

2011-04-26 Thread kelvinfix
(question_list) How can I add the view into admin.py? So that it can be view in the admin index page. -- 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

Re: Tried index in module mymedia.views. Error was: 'module' object has no attribute 'Text'

2011-03-15 Thread hank23
e the form formatted correctly. Thanks again for all the help. On Mar 15, 9:23 am, Karen Tracey wrote: > On Tue, Mar 15, 2011 at 10:14 AM, Tom Evans wrote: > > > On Tue, Mar 15, 2011 at 2:03 PM, hank23 wrote: > > > I get the following error whenever I try to go to the index

Re: Tried index in module mymedia.views. Error was: 'module' object has no attribute 'Text'

2011-03-15 Thread Karen Tracey
On Tue, Mar 15, 2011 at 10:14 AM, Tom Evans wrote: > On Tue, Mar 15, 2011 at 2:03 PM, hank23 wrote: > > I get the following error whenever I try to go to the index screen of > > a new app. I've started: > > > > ViewDoesNotExist at /mymedia/ > > Tried in

Re: Tried index in module mymedia.views. Error was: 'module' object has no attribute 'Text'

2011-03-15 Thread Tom Evans
On Tue, Mar 15, 2011 at 2:03 PM, hank23 wrote: > I get the following error whenever I try to go to the index screen of > a new app. I've started: > > ViewDoesNotExist at /mymedia/ > Tried index in module mymedia.views. Error was: 'module' object has no >

Re: Tried index in module mymedia.views. Error was: 'module' object has no attribute 'Text'

2011-03-15 Thread Karen Tracey
On Tue, Mar 15, 2011 at 10:03 AM, hank23 wrote: > I get the following error whenever I try to go to the index screen of > a new app. I've started: > > ViewDoesNotExist at /mymedia/ > Tried index in module mymedia.views. Error was: 'module' object has no > attrib

Tried index in module mymedia.views. Error was: 'module' object has no attribute 'Text'

2011-03-15 Thread hank23
I get the following error whenever I try to go to the index screen of a new app. I've started: ViewDoesNotExist at /mymedia/ Tried index in module mymedia.views. Error was: 'module' object has no attribute 'Text' I've not been able to see or find anything obvio

Re: acces lists by index

2011-03-10 Thread Brett Parker
{% for x in akt|slice:"-1" %} {{ x }} {% endfor %} Maybe quicker. -- Brett Parker -- 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, s

Re: acces lists by index

2011-03-10 Thread Amao Zhao
django do not sport list[-n] index! On Thu, Mar 10, 2011 at 11:24 PM, Szabo, Patrick (LNG-VIE) < patrick.sz...@lexisnexis.at> wrote: > Hi, > > > > I’m trying to acces the last index of a list in my template but list[-1] > throws the following error: > > > >

AW: acces lists by index

2011-03-10 Thread Szabo, Patrick (LNG-VIE)
. März 2011 16:25 An: django-users@googlegroups.com Betreff: acces lists by index Hi, I'm trying to acces the last index of a list in my template but list[-1] throws the following error: Could not parse the remainder: '[-1]' from 'list[-1]' How can i do it

acces lists by index

2011-03-10 Thread Szabo, Patrick (LNG-VIE)
Hi, I'm trying to acces the last index of a list in my template but list[-1] throws the following error: Could not parse the remainder: '[-1]' from 'list[-1]' How can i do it right !? Kind regards . . . . . . . . . . . . . . . . . . . . . . .

Re: db_index=True doesn't create index

2011-03-03 Thread Dario Bertini
On Mar 2, 12:15 am, Łukasz Rekucki wrote: > Seehttp://code.djangoproject.com/ticket/14651 > > Also, from PostgreSQL's docs: > > One should, however, be aware that there's no need to manually create > indexes on unique columns; doing so would just duplicate the &

Re: db_index=True doesn't create index

2011-03-01 Thread Łukasz Rekucki
tgreSQL's docs: One should, however, be aware that there's no need to manually create indexes on unique columns; doing so would just duplicate the automatically-created index. So there is just no need, to create the index - it's already there. -- Łukasz Rekucki -- You received this me

db_index=True doesn't create index

2011-03-01 Thread Dario Bertini
reduced it to this and the problem still applies) according to: http://docs.djangoproject.com/en/dev/ref/models/fields/#db-index when later running python manage.py sqlindexes blog it should output the create index statements for the relevant fields but it doesn't work... with this bare mode

Render objects on the index page depending on geolocation

2011-02-11 Thread gweltaz
I everyone ! I'd like to render stuff on the index page depending on the user's location but (being a total beginner in web development) i'm not sure about the right way to do this. This is how i intend to do it : In the index's view function : - Check if the location is se

Re: 404 view -> redirect to index

2011-01-18 Thread natebeacham
he scenes ... > > ---8<--- > > hope this helps, > > good luck, > TR > > Am 18.01.2011 um 13:42 schrieb Ivo Brodien: > > > > > > > > > I guess that django catches the 404 Error Code somehow somewhere else than > > in the handle

Re: 404 view -> redirect to index

2011-01-18 Thread Thomas
o 200? > > > On 18.01.2011, at 13:35, galago wrote: > >> Yes I have a index pattern: >> urlpatterns = patterns('', >> url(r'^$', 'index.views.index', name='index'),... >> >> When I add print to my method:

Re: 404 view -> redirect to index

2011-01-18 Thread Thomas
Maybe you have to set the HTTP Code to 200? > > > On 18.01.2011, at 13:35, galago wrote: > >> Yes I have a index pattern: >> urlpatterns = patterns('', >> url(r'^$', 'index.views.index', name='index'),... &

Re: 404 view -> redirect to index

2011-01-18 Thread Ivo Brodien
I guess that django catches the 404 Error Code somehow somewhere else than in the handler? Maybe you have to set the HTTP Code to 200? On 18.01.2011, at 13:35, galago wrote: > Yes I have a index pattern: > urlpatterns = patterns('', > url(r'^$', &#x

Re: 404 view -> redirect to index

2011-01-18 Thread galago
Yes I have a index pattern: urlpatterns = patterns('', url(r'^$', 'index.views.index', name='index'),... When I add print to my method: def custom404(request): print 'foo' return HttpResponseRedirect(reverse('index')) I

Re: 404 view -> redirect to index

2011-01-18 Thread Ivo Brodien
Are you sure, that you have a url pattern called ‘’view? in reverse you have to pass the name of the rule, not the views method name. On 18.01.2011, at 13:22, galago wrote: > I try to redirect from 404 view to my index page. In url.py i added: > handler404 = 'index.views.custom404&

404 view -> redirect to index

2011-01-18 Thread galago
I try to redirect from 404 view to my index page. In url.py i added: handler404 = 'index.views.custom404' in my index i have: def custom404(request): return HttpResponseRedirect(reverse('index')) But it doesn't work. Should I do something more? -- You received

Re: Caught NoReverseMatch while rendering:Reverse for 'index' with arguments '()' and keyword arguments '{}' not found.

2010-12-30 Thread Bartolomé Sánchez
Message error tells that you are trying to reach "index" url, which doesn't exists. Maybe you are calling "index" url instead of "login". 2010/12/30 aaron > Any idea what this means? > > The URL entry is as per the django tutorial as: > &

Caught NoReverseMatch while rendering:Reverse for 'index' with arguments '()' and keyword arguments '{}' not found.

2010-12-30 Thread aaron
Any idea what this means? The URL entry is as per the django tutorial as: (r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'registration/login.html'}), And in my settings.py file I specify LOGIN_URL = 'login/' cheers, A -- You received this message because you are subscribed

Re: Haystack error rebuinding index

2010-12-21 Thread Daniel França
> File "/usr/lib/python2.6/dist-packages/django/core/management/base.py", > line 219, in execute > output = self.handle(*args, **options) > File > "/usr/local/lib/python2.6/dist-packages/haystack/management/commands/update_index.py", > line 51, in handl

Re: Haystack error rebuinding index

2010-12-21 Thread Daniel França
, in handle self.handle_app(None, **options) File "/usr/local/lib/python2.6/dist-packages/haystack/management/commands/update_index.py", line 107, in handle_app index.backend.update(index, small_cache_qs[start:end]) File "build/bdist.linux-x86_64/egg/xapian_backend.py",

Re: Haystack error rebuinding index

2010-12-21 Thread Daniel França
Hi, here's my search index: import datetime from haystack import indexes from haystack import site from profiles.models import Profile class ProfileIndex(indexes.SearchIndex): text = indexes.CharField(use_template=True, document=True) first_name = indexes.CharField(model

Re: Haystack error rebuinding index

2010-12-20 Thread Sam Lai
2010/12/21 Daniel França : > anyone? > > 2010/12/19 Daniel França >> >> Hi all >> I was using haystack(xapian) at a Mac, so I moved it to a Linux (Ubuntu >> 10.10) using python 2.6.6, but now when I try to rebuild the index I get the >> following error: &

Re: Haystack error rebuinding index

2010-12-20 Thread Daniel França
anyone? 2010/12/19 Daniel França > Hi all > I was using haystack(xapian) at a Mac, so I moved it to a Linux (Ubuntu > 10.10) using python 2.6.6, but now when I try to rebuild the index I get the > following error: > AttributeError: 'ProfileIndex' object has n

Haystack error rebuinding index

2010-12-19 Thread Daniel França
Hi all I was using haystack(xapian) at a Mac, so I moved it to a Linux (Ubuntu 10.10) using python 2.6.6, but now when I try to rebuild the index I get the following error: AttributeError: 'ProfileIndex' object has no attribute 'full_prepare' ProfileIndex is my index

Re: App for the index?

2010-11-17 Thread Jason Mayfield
gt; domain.com/blog > domain.com/map > domain.com/links > domain.com/another_app > > What about the index: how would an app (or a flatpage?) for that look > like? An index typically includes some of the blogpost from the blog, > some of the links from the link app and perhaps a

Re: App for the index?

2010-11-17 Thread Thomas Rega
inner. I made an index app and just added it in my urls: > (r'^$', 'index.views.index'), > :) > > On 17 Lis, 11:29, eiriks wrote: >> Most tutorials I've read organize apps into a structure of this sort: >> >> domain.com/blog >> domain.c

Re: App for the index?

2010-11-17 Thread robos85
I'm also beginner. I made an index app and just added it in my urls: (r'^$', 'index.views.index'), :) On 17 Lis, 11:29, eiriks wrote: > Most tutorials I've read organize apps into a structure of this sort: > > domain.com/blog > domain.com/map > domai

App for the index?

2010-11-17 Thread eiriks
Most tutorials I've read organize apps into a structure of this sort: domain.com/blog domain.com/map domain.com/links domain.com/another_app What about the index: how would an app (or a flatpage?) for that look like? An index typically includes some of the blogpost from the blog, some o

index for fields with unique=True and db_index True

2010-11-05 Thread jordi
When I create the following model I get an index for field2 with syndb or sqlindexes. Why doesn't it create an index for field3? from django.db import models class Entitat(models.Model): field1 = models.CharField(max_length=4, unique=True) field2 = models.CharField(max_length=4, db_

Re: Is it possible for template to use context variable as list index?

2010-09-14 Thread bruno desthuilliers
On 14 sep, 16:54, "David.D" wrote: > It's a one-to-one relationship between queryset's content and > my_list's content. > > in my view > > return object_list( request, >                                  queryset=qs, >                                  template_name='my_template.html', >  

Re: Is it possible for template to use context variable as list index?

2010-09-14 Thread David.D
ank you. On Sep 14, 4:03 pm, bruno desthuilliers wrote: > On 13 sep, 18:20, "David.D" wrote: > > > In my template: > > > This is ok: > > {{ my_list.2 }} > > > But it doesn't work: > > {{ my_list.index }} > > > index is a context variab

Re: Is it possible for template to use context variable as list index?

2010-09-14 Thread bruno desthuilliers
On 13 sep, 18:20, "David.D" wrote: > In my template: > > This is ok: > {{ my_list.2 }} > > But it doesn't work: > {{ my_list.index }} > > index is a context variable (index=2) This first looks up my_list for an attribute named "index" - which

Is it possible for template to use context variable as list index?

2010-09-13 Thread David.D
In my template: This is ok: {{ my_list.2 }} But it doesn't work: {{ my_list.index }} index is a context variable (index=2) Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send ema

Re: ForeignKey, Index conflict going from 1.0 to 1.2

2010-09-02 Thread HiTekElvis
That's a huge help in understanding the underlying concepts. Thank you very much. While attempting to answer my question, you actually led me to the answer myself. I was trying to generate an index with South and that was raising the error. Essentially, I was trying to apply an index

Re: ForeignKey, Index conflict going from 1.0 to 1.2

2010-09-02 Thread Russell Keith-Magee
table name. > However, when upgrading to 1.2, I tried to create an index on that > field and got an error, because 1.2 names its foreign keys > [tablename]_[hash] and its index keys [tablename]_[fieldname]_id. > > Is there a solution for this?  A script that renames the foreignkeys > t

ForeignKey, Index conflict going from 1.0 to 1.2

2010-09-02 Thread HiTekElvis
Have a db that was generated under 1.0. Hence, foreign keys in MySQL have been named [tablename]_[fieldname]_id. However, when upgrading to 1.2, I tried to create an index on that field and got an error, because 1.2 names its foreign keys [tablename]_[hash] and its index keys [tablename

Re: debug.py list index out of range

2010-07-15 Thread shwetanka
y", line > > 109, in get_traceback_html > >    frames = self.get_traceback_frames() > > >  File "C:\Python26\lib\site-packages\django\views\debug.py", line > > 228, in get_traceback_frames > >    pre_context_lineno, pre_context, context_line, post_context =

Re: debug.py list index out of range

2010-07-15 Thread shwetanka
ite-packages\django\views\debug.py", line > > 109, in get_traceback_html > >    frames = self.get_traceback_frames() > > >  File "C:\Python26\lib\site-packages\django\views\debug.py", line > > 228, in get_traceback_frames > >    pre_context_lineno, p

Re: debug.py list index out of range

2010-07-15 Thread Tom Evans
ack_frames() > >  File "C:\Python26\lib\site-packages\django\views\debug.py", line > 228, in get_traceback_frames >    pre_context_lineno, pre_context, context_line, post_context = > self._get_lines_from_file(filename, lineno, 7, loader, module_name) > >  File "C

debug.py list index out of range

2010-07-15 Thread shwetanka
ines_from_file(filename, lineno, 7, loader, module_name) File "C:\Python26\lib\site-packages\django\views\debug.py", line 209, in _get_lines_from_file context_line = source[lineno].strip('\n') IndexError: list index out of range -- You received this message be

Re: Dynamic forms through a class factory; 'string index out of range'

2010-04-10 Thread Laereom
t; > > question_manager.generate_question_form(1,question) > > >         question_answer_form = _QuestionAnswerForm() > > > > I'm a bit ambiguous on the details of how class factories / etc work, > > > so I may be doing that bit wrong. > > > >

Re: Dynamic forms through a class factory; 'string index out of range'

2010-04-10 Thread Laereom
= > > question_manager.generate_question_form(1,question) > >         question_answer_form = _QuestionAnswerForm() > > > I'm a bit ambiguous on the details of how class factories / etc work, > > so I may be doing that bit wrong. > > > Either way, when I t

Re: Dynamic forms through a class factory; 'string index out of range'

2010-04-10 Thread Daniel Roseman
_question_form(1,question) >         question_answer_form = _QuestionAnswerForm() > > I'm a bit ambiguous on the details of how class factories / etc work, > so I may be doing that bit wrong. > > Either way, when I try to render this as either just a string or a > form, I get

Dynamic forms through a class factory; 'string index out of range'

2010-04-10 Thread Laereom
n the details of how class factories / etc work, so I may be doing that bit wrong. Either way, when I try to render this as either just a string or a form, I get the following error: Caught an exception while rendering: string index out of range Peeking at the local variables, question_answer_form a

Re: QuerySets - Reverse Look-Up for Index

2010-03-09 Thread Calaganne
ion holds for my sample, and it was true. My test routine was: > >  * for idx, bid in enumerate(bs): >  *     idx, bs.order_by ('?').filter (pk__lt=bid.id).count () - idx == > 0 > > .. strange. > > On Mar 7, 11:50 am, greatlemer wrote: > > > if bids is ord

Re: QuerySets - Reverse Look-Up for Index

2010-03-09 Thread Calaganne
0 .. strange. On Mar 7, 11:50 am, greatlemer wrote: > if bids is ordered by index then you could just return > BID.objects.filter(...).filter(pk__lte=id).count() and that should be > what your after in one step (if I've understood the question > correctly). > > -- > G >

Re: QuerySets - Reverse Look-Up for Index

2010-03-07 Thread greatlemer
if bids is ordered by index then you could just return BID.objects.filter(...).filter(pk__lte=id).count() and that should be what your after in one step (if I've understood the question correctly). -- G On Mar 7, 7:10 am, Hasan Karahan wrote: > Hi, > > I'm wondering if there

QuerySets - Reverse Look-Up for Index

2010-03-06 Thread Hasan Karahan
Hi, I'm wondering if there is an efficient way to look-up the index of a given object in a query-set? I'm using now the following approach: def get_index (id): bids = BID.objects.filter (..) obj2idx = dict (zip (bids, xrange (bids.count ())) bid = BID.objects.get (id=ID) return ob

Index Error with empty queries

2010-02-18 Thread Chris McComas
I have this in my views, if there lor1 and lor2 are both there it works fine, but if one or two of them are missing then it gives me this error. views.py - http://dpaste.com/161124/ error - http://dpaste.com/161128/ Some applicants have two LORs, some have one LOR, and obviously some don't have

Can't execute SQL functions in app_name/sql/*.sql (IndexError: tuple index out of range)

2009-11-14 Thread Monika Sulik
ically it takes the id of a skater and a string and checks whether the name||' '||surname of the skater or the surname||' '||name of the skater contains the string and returns true if it does. I've put this in the app_name/sql/ folder, so that it executes with the first syncdb

Re: create Index: non-unique, multiple column

2009-10-16 Thread Michael P. Jung
> Given the following model, I want to index the fields (sequence,stock) There is a ticket for it, but it hasn't made it into Django, yet. http://code.djangoproject.com/ticket/373 > create index ndx_1 on model_quotemodel(sequence,stock); > Is there any "cleaner" way of

create Index: non-unique, multiple column

2009-10-16 Thread jneto
Given the following model, I want to index the fields (sequence,stock) class QuoteModel(models.Model): quotedate = models.DateField() high = models.FloatField() #(9,2) DEFAULT NULL, low = models.FloatField() #(9,2) DEFAULT NULL, close = models.FloatField() #(9,2) DEFAULT NULL

Re: How to get ./manage.py test to stop spewing "Installing index for whatever"

2009-10-13 Thread Phlip
Михаил Лукин wrote: > ./manage.py help test > Does changing verbosity help? Da! Thanks! and my theory was correct - I wasn't even noticing this one: Failed to install custom SQL for searchable.Searchable model: near "(": syntax error Don't worry about me I will fix it... But note the fixture

Re: How to get ./manage.py test to stop spewing "Installing index for whatever"

2009-10-13 Thread Михаил Лукин
./manage.py help test Does changing verbosity help? On Tue, Oct 13, 2009 at 10:59 PM, Phlip wrote: > > Djangoids: > > Unit tests should run as silent as possible, so we don't get too > familiar with their spew. Ideally, any spew should raise your index of > suspicion

How to get ./manage.py test to stop spewing "Installing index for whatever"

2009-10-13 Thread Phlip
Djangoids: Unit tests should run as silent as possible, so we don't get too familiar with their spew. Ideally, any spew should raise your index of suspicion, and a test batch that always spews the same things might make you complacent to any exceptional spew. So, how to turn off the

IndexError: list index out of range

2009-09-21 Thread Chris McComas
I am trying to write to CSV, I was able to do so before, not sure what the problem is... When my query returns results, I get this error http://dpaste.com/96399/ Here's my view http://dpaste.com/96398/ If the query is empty it opens the CSV with only the header row... What am I doing wrong? --

Sitemap index examples needed

2009-09-07 Thread Oleg Oltar
Hi! I have following models relation: class Section(models.Model): section = models.CharField(max_length=200, unique=True) name = models.CharField(max_length=200, blank = True) class Article (models.Model): url = models.CharField(max_length = 30, unique=True)

alternative to using index number to refer to inline admin formsets in template?

2009-08-30 Thread sico
Hey, I can get to the inline_admin_formset by indexing the inline_admin_formsets variable e.g. {{ inline_admin_formsets.0.formset }} is there an alternative to use the index number for picking the formset?? I've tried the model name but it doesn't seem to work... any suggestions

Re: Coltrane application not appearing on the admin index page

2009-08-26 Thread Daniel Roseman
trane" application does not appear on the admin index page as > the book suggest. > > This is my INSTALLED_APPS in the settings.py in the cms application; > > INSTALLED_APPS = ( >     'django.contrib.auth', >     'django.contrib.content

Coltrane application not appearing on the admin index page

2009-08-26 Thread Gath
Guys, Am going through the practical django book and am trying the weblog application in Chapter 4, but when i go to test the application on my cms application (that i created from the same book, from Chapter 2 & 3) "coltrane" application does not appear on the admin index pa

Re: Why no index on auth_user username field?

2009-04-18 Thread Malcolm Tredinnick
On Sat, 2009-04-18 at 21:22 -0700, meppum wrote: > I noticed that there is a unique constraint and maybe that infers an > index, but if it doesn't, why isn't an index on this column needed? The unique constraint does provide an index. Otherwise inserts would be very inefficient

Re: IndexError (list index out of range) in admin when updating a regex char primary key

2009-03-29 Thread TeenSpirit83
alue to 'Second', a queryset of AssociatedThing objects that point to > 'Second' returns 0 results.  The admin tries to create a formset using a > queryset that specifies the new pk value, but the objects in that queryset > don't match up to the POST data in the

Re: IndexError (list index out of range) in admin when updating a regex char primary key

2009-03-26 Thread Karen Tracey
ing a queryset that specifies the new pk value, but the objects in that queryset don't match up to the POST data in the request. This mismatch results in the the formset creation code causing list index out of range when trying to match up the POST data with a non-existent matching objects in

IndexError (list index out of range) in admin when updating a regex char primary key

2009-03-26 Thread TeenSpirit83
t_form (i, **kwargs) File "C:\Django-1.0.2\django\forms\models.py" in _construct_form 356. kwargs['instance'] = self.get_queryset()[i] File "C:\Django-1.0.2\django\db\models\query.py" in __getitem__ 221. return self._result_cache[k] Ex

Re: Creating a multi-column index

2009-03-08 Thread Matt Doran
Hi Alex + Malcolm, On Mar 9, 4:03 pm, Malcolm Tredinnick wrote: > On Sun, 2009-03-08 at 21:58 -0700, Matt Doran wrote: > > Hi there, > > > I'm porting another system across to Django, and I need to create a > > multi-column unique index.  I previously used SQLObje

Re: Creating a multi-column index

2009-03-08 Thread Malcolm Tredinnick
On Sun, 2009-03-08 at 21:58 -0700, Matt Doran wrote: > Hi there, > > I'm porting another system across to Django, and I need to create a > multi-column unique index. I previously used SQLObject which has a > syntax for doing this. > > I came across this old post th

Re: Creating a multi-column index

2009-03-08 Thread Alex Gaynor
On Sun, Mar 8, 2009 at 11:58 PM, Matt Doran wrote: > > Hi there, > > I'm porting another system across to Django, and I need to create a > multi-column unique index. I previously used SQLObject which has a > syntax for doing this. > > I came across this old post tha

Creating a multi-column index

2009-03-08 Thread Matt Doran
Hi there, I'm porting another system across to Django, and I need to create a multi-column unique index. I previously used SQLObject which has a syntax for doing this. I came across this old post that said it wasn't possible and it referred to creating custom backend SQ

<    1   2   3   4   >