count resulting rows in sliced valuesqueryset

2012-11-21 Thread ?manu*
Suppose I have a queryset qs. For paginating purposes I need to do something like: count = qs.count() qs = qs[0:100] Unfortunately this executes the query twice, which I don't want. I can use postgresql windowing function like that: qs = q.extra(select = {'count': 'COUNT(*) OVER()'}) to get

Re: how to use get_queryset in my code

2012-11-21 Thread ?manu*
On Wednesday, November 21, 2012 7:53:59 AM UTC+1, Nebros wrote: > Its not a problem of the version, my pycharm gave no error, but it was not > possible to generate the model... by generating there was always an > error, like it cant find an class or something else > Are you sure the problem is

Re: login page shouldn't open when I am already logged in, but it does !

2012-11-21 Thread Loai Ghoraba
Well, thanks very much for your effort-y reply. I have read it and it is useful, though it requires a second reading to recap :) Well, I thought of a simple solution and it worked: just having a wrapping function around django login such that it checks whether the use is logged in or not before

Re: login page shouldn't open when I am already logged in, but it does !

2012-11-21 Thread Daniel Roseman
On Wednesday, 21 November 2012 12:04:45 UTC, Loai Ghoraba wrote: > Well, thanks very much for your effort-y reply. I have read it and it is > useful, though it requires a second reading to recap :) > > Well, I thought of a simple solution and it worked: just having a wrapping > function around d

Creating a torrent file & associated tracker through a django web app

2012-11-21 Thread ashish makani
Hi Folks Following is a description of what i am trying to achieve : The user should log into a web app, select a file & be able to create a torrent & a private tracker(http://IP_ADDRESS:PORT/announce) gets created for that torrent. I found two libraries mktorrent[1] & py3createtorrent [2], b

Re: django admin site

2012-11-21 Thread Valentin Rozescu
Yes, I did the steps as in the tutorial. In addition I create one more superuser as described. Thank you marți, 20 noiembrie 2012, 20:03:13 UTC+2, iñigo medina a scris: > > On Tue, 20 Nov 2012, Valentin Rozescu wrote: > > > > > > > I am going step by step in the tutorial "Writing your first Dj

Re: django admin site

2012-11-21 Thread Valentin Rozescu
I am using Sqlite3 Thank you for your time -- 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/-/tukjIMgOCn4J. To post to this group, send email to django-users@

Re: What's the difference between django.views.generic.ListView and django.views.generic.list_detail?

2012-11-21 Thread Ankur Sethi
On Wed, Nov 21, 2012 at 11:02 AM, Dae_James wrote: > What's the difference between django.views.generic.*ListView* and > django.views.generic.*list_detail*? > > I think the two have same function. Only the usage of them are different. > Why do both of them exist? The django.views.generic.list_d

Re: Can't get Web font loader in django

2012-11-21 Thread Chris Pagnutti
Sounds like a great idea. I'm going to give it a try. In the meantime, though...why can I get the script no problem using a non-django, pure html+js page? On Tuesday, November 20, 2012 6:58:17 PM UTC-5, Issam Outassourt wrote: > > { > "error": { > "errors": [ >{ > "domain": "usageLi

Re: login page shouldn't open when I am already logged in, but it does !

2012-11-21 Thread Loai Ghoraba
Thanks for user.is_authenticated(), , but Django built in login view function doesn't call it before executing. So I guess I have to wrap Django login myself when using it. So the code will change to be this, I use this to wrap only Django login function-since I cannot modify it-, otherwise I

Re: need help with postgres installation and set-up for doing tutorials

2012-11-21 Thread Luisa Beck
Thank you for your thoughts! I have a few follow-up questions: *The reason that I’m trying to figure out postgres is that I’m helping some folks with a development project and they’re using postgres. I’m trying to do the tutorial with that so that I can get familiar with postgres and the pgAdm

Re: count resulting rows in sliced valuesqueryset

2012-11-21 Thread Javier Guerra Giraldez
On Wed, Nov 21, 2012 at 5:53 AM, ?manu* wrote: > count = qs.count() > qs = qs[0:100] > > Unfortunately this executes the query twice, which I don't want. while clearly non-optimal, i would guess that Postgresql's caches should be able to skip most of the processing. Have you measured the time im

Re: django admin site

2012-11-21 Thread Yogev Metzuyanim
Try to delete the db file and syncdb again On Tuesday, November 20, 2012 5:49:40 PM UTC+2, Valentin Rozescu wrote: > > I am going step by step in the tutorial "Writing your first Django app" ( > https://docs.djangoproject.com/en/dev/intro/tutorial01/) but in the part > 2, step creating admin site

how to show the text line number in the left of the textarea

2012-11-21 Thread jianhui chen
Hi all, I was wondering how can I show the text line numbers in the left of the text area. The result is somehow like this: 1 this is first line. 2 this is second line. ; The number is in the outside of the box, and it is automatically displayed when the user change the line.

Re: need help with postgres installation and set-up for doing tutorials

2012-11-21 Thread Thomas Lockhart
*On 11/21/12 5:58 AM, Luisa Beck wrote:** * *Thank you for your thoughts! I have a few follow-up questions: * * * *The reason that I’m trying to figure out postgres is that I’m helping some folks with a development project and they’re using postgres. I’m trying to do the tutorial with that so t

Re: Request for inspiration on business system

2012-11-21 Thread Peter Edström
*Lachlan Musicman:* You recommend using virtualenv. Why and in what scenarios? If I understand it correctly, virtualenv sets up a virtual python environment galvanically isolated from the rest of the system and I see how this let you go crazy and experiment without risking anything. Is this the

Re: how to use get_queryset in my code

2012-11-21 Thread Nebros
yes, i copied all data in the correct folder, but it didnt work. but thats not more my problem... i changed row = cursor.fetchall() into row = cursor.fetchone() this give me out the correct data into the correct column of my table. my next problem there is, why it doesent work with fetchall o

Re: html in django password_reset_email.html

2012-11-21 Thread larry.mart...@gmail.com
On Tuesday, November 2, 2010 5:50:49 AM UTC-4, Tom Evans wrote: > > On Tue, Nov 2, 2010 at 9:07 AM, andy > > wrote: > > I recently tried to send the following in a test password email from a > > site I am creating: > > > > This is a test reset password email. > > > > However when I received the em

Re: Request for inspiration on business system

2012-11-21 Thread Javier Guerra Giraldez
On Wed, Nov 21, 2012 at 10:11 AM, Peter Edström wrote: > You recommend using virtualenv. Why and in what scenarios? always. each and every time i haven't used it, i've regretted it later. it not only lets you experiment but also in deployment you're guaranteed a stable environment. Also it ma

DetailView

2012-11-21 Thread David
Hello I am trying to use a class based generic view (DetailView) to view user profiles. What I am trying to achieve is: if no user PK is provided in the URL show the logged in user. If there is a user PK in the URL show that user. Thus reducing the need to have 2 views. My code currently erro

AW: DetailView

2012-11-21 Thread Szabo, Patrick (LNG-VIE)
Hi, Code looks fine to me, maybe you could give us the exact error message ? You could also try request.user.id or something to get the actual pk and not only the user object but that’s just a guess. Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im Auftrag von David

I want to learn programming and codes !

2012-11-21 Thread garlicdud
Can anyone give me direction for on-line TUTORIAL with python django under Linux precise pangolin ? -- 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/-/hTj72s

Re: I want to learn programming and codes !

2012-11-21 Thread Jonathan Baker
I would start with Django 1.3 and the following tutorial: http://www.djangobook.com/en/2.0/index.html Cheers, Jonathan On Wed, Nov 21, 2012 at 8:57 AM, garlicdud wrote: > Can anyone give me direction for on-line TUTORIAL with python django > under Linux precise pangolin ? > > -- > You received

Re: html in django password_reset_email.html

2012-11-21 Thread Tom Evans
On Wed, Nov 21, 2012 at 3:27 PM, larry.mart...@gmail.com wrote: > On Tuesday, November 2, 2010 5:50:49 AM UTC-4, Tom Evans wrote: >> >> On Tue, Nov 2, 2010 at 9:07 AM, andy wrote: >> > I recently tried to send the following in a test password email from a >> > site I am creating: >> > >> > This i

Re: DetailView

2012-11-21 Thread Tom Evans
On Wed, Nov 21, 2012 at 3:45 PM, David wrote: > Hello > > I am trying to use a class based generic view (DetailView) to view user > profiles. > > What I am trying to achieve is: if no user PK is provided in the URL show > the logged in user. If there is a user PK in the URL show that user. Thus >

Re: DetailView

2012-11-21 Thread David
Thank you for you reply Tom. I am now getting: "Generic detail view home must be called with either an object pk or a slug." I have tried using the pk line you pointed to in the get_queryset method. Should I instead be trying to use def get: ? -- You received this message because you are sub

Re: Request for inspiration on business system

2012-11-21 Thread Issam Outassourt
Well, I do not totally agree with your point. The problem with virtual environments such as these is that you have trouble sometimes figuring out what actually happens behind the scripts that are used to initialize your environment. Thus comes a natural habit that I personally developed which is to

Re: DetailView

2012-11-21 Thread David
Think I now have this working with the following: def get_queryset(self): self.kwargs['pk'] = self.kwargs.get('pk', self.request.user.id) UserModel = get_user_model() profile = UserModel.objects.filter(pk=self.kwargs['pk']) return profile Thanks for your replie

Re: Request for inspiration on business system

2012-11-21 Thread Tom Evans
On Wed, Nov 21, 2012 at 5:23 PM, Issam Outassourt wrote: > Well, I do not totally agree with your point. > The problem with virtual environments such as these is that you have trouble > sometimes figuring out what actually happens behind the scripts that are > used to initialize your environment.

Re: I want to learn programming and codes !

2012-11-21 Thread carlos
example http://lightbird.net/dbe/ good tutorial Cheers On Wed, Nov 21, 2012 at 10:02 AM, Jonathan Baker < jonathandavidba...@gmail.com> wrote: > I would start with Django 1.3 and the following tutorial: > http://www.djangobook.com/en/2.0/index.html > > Cheers, > Jonathan > > > On Wed, Nov 21, 20

Re: html in django password_reset_email.html

2012-11-21 Thread Larry Martell
On Wed, Nov 21, 2012 at 11:04 AM, Tom Evans wrote: > On Wed, Nov 21, 2012 at 3:27 PM, larry.mart...@gmail.com > wrote: >> On Tuesday, November 2, 2010 5:50:49 AM UTC-4, Tom Evans wrote: >>> >>> On Tue, Nov 2, 2010 at 9:07 AM, andy wrote: >>> > I recently tried to send the following in a test pas

Re: Django web app pages not displaying

2012-11-21 Thread Babatunde Akinyanmi
Hmmm. I guess you'll just have to dig deep into your code and make sure you haven't made any mistakes especially if you are using conditionals to choose which template to render. Can you mail the link to me? On 11/21/12, coded kid wrote: > I set Debug=False. It didn't bring any errors. Also djang

Re: Request for inspiration on business system

2012-11-21 Thread Lachlan Musicman
On Thursday, November 22, 2012, Peter Edström wrote: > *Lachlan Musicman:* > You recommend using virtualenv. Why and in what scenarios? If I understand > it correctly, virtualenv sets up a virtual python environment galvanically > isolated from the rest of the system and I see how this let you go

Re: Creating a torrent file & associated tracker through a django web app

2012-11-21 Thread Lachlan Musicman
On Wednesday, November 21, 2012, ashish makani wrote: > Hi Folks > > Following is a description of what i am trying to achieve : > > The user should log into a web app, select a file & be able to create a > torrent & a private tracker(http://IP_ADDRESS:PORT/announce) gets created > for that torren

Django ORM

2012-11-21 Thread Alexandra Paredes
Good afternoon, I'm an student of Computer Engineering from Simón Bolívar University, in Caracas Venezuela. I'm working with a friend on a thesis about ORM and their "respectfulness" on databases.For a better understanding of Django ORM, we tried to read the code itself as subject by Russ Mage

Re: DetailView

2012-11-21 Thread David
Hi Patrick The error exists on this line: pk = self.kwargs['pk'] KeyError at /accounts/profile/ 'pk' Request Method: GET Request URL: http://127.0.0.1:8000/accounts/profile/ Django Version: 1.5 Exception Type: KeyError Exception Value: 'pk' Exception Location: C:\Users\DavidWills.DELTAGEM\Dja

Re: how to show the text line number in the left of the textarea

2012-11-21 Thread Mario Gudelj
Use JS for that. You'll find a code snippet here that will do it http://www.dhtmlgoodies.com/forum/viewtopic.php?t=506 On 22 November 2012 01:27, jianhui chen wrote: > Hi all, > I was wondering how can I show the text line numbers in the left of > the text area. > The result is somehow

syncing sqlite3 for Django tutorial

2012-11-21 Thread Luisa Beck
I'm starting the Django tutorials and have virtual environments and django installed. I'm working on a Mac 10.6.8, which has sqlite3 already installed. I'm working inside a virtual environment. I changed the settings.py file to: ENGINE -- 'django.db.backends.sqlite3' I left the NAME -- in the

Re: syncing sqlite3 for Django tutorial

2012-11-21 Thread Lee Hinde
>From the docs: NAME -- The name of your database. If you're using SQLite, the database will be a file on your computer; in that case, NAME should be the full absolute path, including filename, of that file. If the file doesn't exist, it will automatically be created when you synchronize the d

Re: Django ORM

2012-11-21 Thread Russell Keith-Magee
On Thu, Nov 22, 2012 at 7:34 AM, Alexandra Paredes <05-38...@usb.ve> wrote: > Good afternoon, > > I'm an student of Computer Engineering from Simón Bolívar University, in > Caracas Venezuela. I'm working with a friend on a thesis about ORM and > their "respectfulness" on databases.For a better und

Understanding virtual environment paths

2012-11-21 Thread Luisa Beck
I have a question about virtual environments: Say I've activated a virtual environment. I'm working with SQlite3 (already installed on my Mac 10.6.8) and I save a .db file outside of my project directory. If I save the path outside the project directory, will I still have access to it when I'

Re: Understanding virtual environment paths

2012-11-21 Thread André Dieb
The virtual environment is like a sandbox that has its own python executable and its own python libraries. Your .db file is perfectly accessible from inside the env. On Wed, Nov 21, 2012 at 9:30 PM, Luisa Beck wrote: > I have a question about virtual environments: > > Say I've activated a virtu

Re: Django ORM

2012-11-21 Thread I単igo Medina
On Wed, 21 Nov 2012, Alexandra Paredes wrote: Good afternoon, I'm an student of Computer Engineering from Simón Bolívar University, in Caracas Venezuela. I'm working with a friend on a thesis about ORM and their "respectfulness" on databases.For a better understanding of Django ORM, we tried

Seeding Foreign Key with known object with Class Based Views

2012-11-21 Thread Lee Hinde
I have two tables, Client and Address. Address has a foreign key 'client' which points to the client table. I'll make my user enter a client and then enter 1-x Addresses. I'll know which client the address is being linked to before the record is created, with a url like : /client/3/address/new/. I

Re: Re: What's the difference between django.views.generic.ListView and django.views.generic.list_detail?

2012-11-21 Thread Dae James
Yes, thank you very much. I got it. Dae James From: Ankur Sethi Date: 2012-11-21 15:08 To: django-users Subject: Re: What's the difference between django.views.generic.ListView and django.views.generic.list_detail? On Wed, Nov 21, 2012 at 11:02 AM, Dae_James wrote: What's the difference bet