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
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
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
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
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
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
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@
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
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
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
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
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
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
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.
*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
*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
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
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
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
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
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
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
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
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
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
>
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
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
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
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.
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
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
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
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
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
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
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
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
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
>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
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
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'
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
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
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
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
45 matches
Mail list logo