Re: Postgres and backup/restore

2014-02-06 Thread Mike Dewhirst

On 7/02/2014 10:51am, Simon Riggs wrote:

On 7 February 2014 00:31, Mike Dewhirst  wrote:

On 7/02/2014 10:07am, Lachlan Musicman wrote:


Hola,

What are people's recommendations for postgres db backup solutions?

I've just installed django-dbbackup and will give it a try, but
thought I'd ask what others were using.



Daily dump to a file which is backed up across the network.

http://www.postgresql.org/docs/9.3/static/app-pgdump.html

I'm planning to do something clever with the transaction log continuously
writing it to another machine but I haven't done that yet.

One day real soon now.


Today is good. Streaming replication does exactly that.

http://www.postgresql.org/docs/9.3/static/warm-standby.html#STREAMING-REPLICATION


You are absolutely right and it is one of the primary reasons I chose 
Postgres.


Streaming replication is in my project's future not only for backup but 
also for read-only output from replication machines. We are not that far 
advanced yet.


Earlier instead of "I haven't done that yet" I should have said "I 
havn't hired a professional DBA yet" ;)


Thanks Simon

Mike










--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52F4786C.9080407%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.


Re: two apps against one table (admin)

2014-02-06 Thread Drew Ferguson
Hi

This seems a very complicated solution to a fairly basic problem unless I
am missing something

> On Feb 7, 2014 2:24 AM, "fborell"  wrote:
> 
> > I need to create a second application in the admin section that ports
> > to the first applications model. The second application's admin.py
> > would contain only 5 of the 15 fields and be set for read-only.
> > My goal was to allow certain users the ability to do a simple search
> > and not see some of the other data that they weren't authorized for.
> >
> > Any thoughts on how to proceed?

Create a regular ListView only showing the fields you want and then add an
ordinary form field to the template to input your search term (I would
usually include it with pagination controls)

In your view you can then filter the queryset on the search term like this

#views.py
  def get_queryset(self):
qs = super(MyListView, self).get_queryset()
if 'SEARCH' in self.request.GET:
  search = self.request.GET['SEARCH']
  qs =
  qs.filter(Q(field1__icontains=search)|Q(field2__icontains=search)) 
return qs

There is more on "Complex lookups with Q objects" in

https://docs.djangoproject.com/en/1.6/topics/db/queries/

-- 
Drew

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140207015103.6ba1b05b%40blacktav.fergiesontour.org.
For more options, visit https://groups.google.com/groups/opt_out.


Re: two apps against one table (admin)

2014-02-06 Thread Ariel E. Isidro
What if you define your views to use only the fields that you need?
On Feb 7, 2014 2:24 AM, "fborell"  wrote:

> All,
>
> I need to create a second application in the admin section that ports to
> the first applications model. The second application's admin.py would
> contain only 5 of the 15 fields and be set for read-only.
> My goal was to allow certain users the ability to do a simple search and
> not see some of the other data that they weren't authorized for.
>
> Any thoughts on how to proceed?
>
> Thank,
>
> -f
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d1ed61d4-16d9-4a51-a537-d46a1f334d3a%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAECOjia6C34LOi28TBK%2Bs_Fqpy_c0nXkpq8FOmpk71_-Hwaqdw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: sprint at europython 2014

2014-02-06 Thread Russell Keith-Magee
Hi,

Django sprints at PyCon events aren't usually formally announced; it's just
assumed that there will be a bunch of Django people present, usually some
core devs, and that they will be looking at Django problems, or will be
able to answer Django related questions if they arise.

I can't speak for EuroPython specifically, however; I've never attended.

Yours,
Russ Magee %-)


On Fri, Feb 7, 2014 at 5:29 AM, waverider  wrote:

> Hi,
>
> Will there be a Django sprint at EuroPython 2014?
> I didn't notice Django sprints at previous EuroPython conferences. Why not?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d87a4705-64c0-426c-814c-024aab2e15d6%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJxq84--q1HOu5oK1fmoZPzajcW2ackDLjek5h-PUF3MW_BqGw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Postgres and backup/restore

2014-02-06 Thread Simon Riggs
On 7 February 2014 00:31, Mike Dewhirst  wrote:
> On 7/02/2014 10:07am, Lachlan Musicman wrote:
>>
>> Hola,
>>
>> What are people's recommendations for postgres db backup solutions?
>>
>> I've just installed django-dbbackup and will give it a try, but
>> thought I'd ask what others were using.
>
>
> Daily dump to a file which is backed up across the network.
>
> http://www.postgresql.org/docs/9.3/static/app-pgdump.html
>
> I'm planning to do something clever with the transaction log continuously
> writing it to another machine but I haven't done that yet.
>
> One day real soon now.

Today is good. Streaming replication does exactly that.

http://www.postgresql.org/docs/9.3/static/warm-standby.html#STREAMING-REPLICATION

-- 
 Simon Riggs   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BU5nMLJ6AbC7AdF5ixV0ni_HPfzEZ2XpmPwXoKRdwV2vnSQDA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Postgres and backup/restore

2014-02-06 Thread Mike Dewhirst

On 7/02/2014 10:07am, Lachlan Musicman wrote:

Hola,

What are people's recommendations for postgres db backup solutions?

I've just installed django-dbbackup and will give it a try, but
thought I'd ask what others were using.


Daily dump to a file which is backed up across the network.

http://www.postgresql.org/docs/9.3/static/app-pgdump.html

I'm planning to do something clever with the transaction log 
continuously writing it to another machine but I haven't done that yet.


One day real soon now.



cheers
L.







--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52F41B3D.5010407%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Postgres and backup/restore

2014-02-06 Thread John DeRosa
pg_dump is all you need, if your db is small enough. It generates a consistent 
backup.

pg_dump, zip, stash it in a cloud container named "backup" is what we do.

John

On Feb 6, 2014, at 3:07 PM, Lachlan Musicman  wrote:

> Hola,
> 
> What are people's recommendations for postgres db backup solutions?
> 
> I've just installed django-dbbackup and will give it a try, but
> thought I'd ask what others were using.
> 
> cheers
> L.
> 
> 
> 
> 
> 
> -- 
> From this perspective it is natural that anarchism be marked by
> spontaneity, differentiation, and experimentation that it be marked by
> an expressed affinity with chaos, if chaos is understood to be what
> lies outside or beyond the dominant game or system. Because of the
> resistance to definition and categorisation, the anarchist principle
> has been variously interpreted as, rather than an articulated
> position, "a moral attitude, an emotional climate, or even a mood".
> This mood hangs in dramatic tension between utopian hope or dystopian
> nihilism...
> -
> http://zuihitsu.org/godspeed-you-black-emperor-and-the-politics-of-chaos
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAGBeqiMREb74W8jX-5wTFL4Btg7C4NYC6fipL%2B%3DXB91nqD7xKg%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/507345A1-916B-4DC8-8233-6073CB64F184%40ipstreet.com.
For more options, visit https://groups.google.com/groups/opt_out.


Postgres and backup/restore

2014-02-06 Thread Lachlan Musicman
Hola,

What are people's recommendations for postgres db backup solutions?

I've just installed django-dbbackup and will give it a try, but
thought I'd ask what others were using.

cheers
L.





-- 
>From this perspective it is natural that anarchism be marked by
spontaneity, differentiation, and experimentation that it be marked by
an expressed affinity with chaos, if chaos is understood to be what
lies outside or beyond the dominant game or system. Because of the
resistance to definition and categorisation, the anarchist principle
has been variously interpreted as, rather than an articulated
position, “a moral attitude, an emotional climate, or even a mood”.
This mood hangs in dramatic tension between utopian hope or dystopian
nihilism...
-
http://zuihitsu.org/godspeed-you-black-emperor-and-the-politics-of-chaos

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGBeqiMREb74W8jX-5wTFL4Btg7C4NYC6fipL%2B%3DXB91nqD7xKg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[ANNOUNCE] Django 1.6.2 and Django 1.7a2

2014-02-06 Thread Jacob Kaplan-Moss
Hey y'all --

We've just released Django 1.6.2, the latest bugfix release in the 1.6
series, and Django 1.7a2, the second alpha preview of the upcoming 1.7
release.

As usual, more details are available on the blog:


https://www.djangoproject.com/weblog/2014/feb/06/django-162-and-django-17a2-released/

And you can snag the releases from
https://www.djangoproject.com/download/and from PyPI.

Enjoy!

Jacob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK8PqJEtMLZ8f%3Dr_NQOexecdZkg73hESb09ZG%2B5onbSYOxCWig%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


sprint at europython 2014

2014-02-06 Thread waverider
Hi,

Will there be a Django sprint at EuroPython 2014?
I didn't notice Django sprints at previous EuroPython conferences. Why not?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d87a4705-64c0-426c-814c-024aab2e15d6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: two apps against one table (admin)

2014-02-06 Thread fborell
Proxy models seem to do the trick ...

On Thursday, February 6, 2014 1:23:31 PM UTC-5, fborell wrote:
>
> All,
>
> I need to create a second application in the admin section that ports to 
> the first applications model. The second application's admin.py would 
> contain only 5 of the 15 fields and be set for read-only.
> My goal was to allow certain users the ability to do a simple search and 
> not see some of the other data that they weren't authorized for. 
>
> Any thoughts on how to proceed?
>
> Thank,
>
> -f
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/de66dd27-9db4-4ccb-acc1-3a249d9ddd22%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Should I keep used email confirmations?

2014-02-06 Thread voger
Hi, I am using django-allauth to register and authenticate users in my 
site. I am a little bit confused with the way it handles email 
verifications. After the message is sent to the user and the user 
confirms his email the confirmation stays available on the site. I saw 
the source code for the ConfirmEmailView(TemplateResponseMixin, View) 
class and there in the comments, after it logins the user right after 
the confirmation, it says


# Simply logging in the user may become a security issue. If you
# do not take proper care (e.g. don't purge used email
# confirmations), a malicious person that got hold of the link
# will be able to login over and over again and the user is
# unable to do anything about it. Even restoring his own mailbox
# security will not help, as the links will still work. For
# password reset this is different, this mechanism works only as
# long as the attacker has access to the mailbox. If he no
# longer has access he cannot issue a password request and
# intercept it. Furthermore, all places where the links are
# listed (log files, but even Google Analytics) all of a sudden
# need to be secured. Purging the email confirmation once
# confirmed changes the behavior -- users will not be able to
# repeatedly confirm (in case they forgot that they already
# clicked the mail).

I have already overridden that class so it doesn't auto login the user 
after successful confirmation and it deletes the used confirmation. If 
the user needs a new confirmation it generates a new one and sends it.


My question is, why allauth keeps the used confirmation even if it says 
it must be purged? Is there any reason to keep the used confirmation and 
am I doing something wrong by deleting it?


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52F3F5F4.70701%40yahoo.gr.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Optimizing DB query involving annotate and aggregate

2014-02-06 Thread Arnold Krille
On Wed, 5 Feb 2014 10:11:29 -0800 (PST) ST 
wrote:
> Hi,
> 
> I'm trying to optimize the run-time of getting total credit and debt
> values out of our database. Ideally I'd like to formulate it as a
> Django query. This is the raw SQL query I have, which produces the
> right answer and is very fast (milliseconds):
> 
> SELECT sum(tg.total) FROM
>   (
>   SELECT sum(t.amount) AS total, t.member_id AS member_id
>   FROM club_transaction AS t
>   WHERE t.member_id IS NOT NULL
>   GROUP BY t.member_id
>   ) AS tg
> WHERE tg.total < 0
> 
> (plus a second query for > 0)
> 
> My Django implementation was:
> 
> m =
> Member.objects.annotate(balance=Sum('transaction__amount')) m_debt =
> m.filter(balance__lt=0).aggregate(total=Sum('balance')) m_credit =
> m.filter(balance__gt=0).aggregate(total=Sum('balance'))
> 
> which looks a lot nicer, is easier to understand and maintain.
> 
> However, it results in the following SQL query (slightly redacted):
> 
> SELECT SUM(balance) FROM
>   (
>   SELECT "club_member"."id" AS "id", {all the other fields}, 
> SUM("club_transaction"."amount") AS "balance"
>   FROM "club_member"
>   LEFT OUTER JOIN "auth_user" ON ("club_member"."user_id" = 
> "auth_user"."id")
>   LEFT OUTER JOIN "club_transaction" ON ("club_member"."id" = 
> "club_transaction"."member_id")
>   GROUP BY "club_member"."id", {all the other fields}, 
> "auth_user"."last_name", "auth_user"."first_name"
>   HAVING SUM("club_transaction"."amount") < 0
>   ORDER BY "auth_user"."last_name" ASC, "auth_user"."first_name" ASC
>   ) subquery
> 
> (again, plus another one for > 0)
> which is very slow (almost 1.5 seconds).
> 
> How can I construct a Django query which doesn't request (and group
> by) all the unnecessary other fields ?
> I already tried playing around with only() and values() but never got
> it to work.

I did something similar a few years back. Its next to impossible with
django-orm, just do it in raw sql.
The django-orm can't really do any advanced group_by clauses. And you
can't give them with extra(). Well, you can give them but they won't be
used;-)

Doing two (or three) orm-queries and then joining the data in python
will actually be slower then doing it all in hand-crafted sql.

So just do the sql by hand. And then optimize by having three columns,
one with the SUM(amount) if amount>0, one with the SUM(amount) if
amount<0 and one with the SUM(amount). Total credits, total depts and
balance all in one query (if possible)...

- Arnold


signature.asc
Description: PGP signature


two apps against one table (admin)

2014-02-06 Thread fborell
All,

I need to create a second application in the admin section that ports to 
the first applications model. The second application's admin.py would 
contain only 5 of the 15 fields and be set for read-only.
My goal was to allow certain users the ability to do a simple search and 
not see some of the other data that they weren't authorized for. 

Any thoughts on how to proceed?

Thank,

-f

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d1ed61d4-16d9-4a51-a537-d46a1f334d3a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: moving from sqlite3 to mysql

2014-02-06 Thread Malik Rumi
Ok, I got it working. And by working, I mean I got it to sync, I imported
the database.json into mysql, and when I runserver everything is there as
it should be.
So, many thanks to all my gracious and more senior django users for your
patient guidance and assistance.
A note to all newbies who may be following along and reading this days,
weeks, and years from now: Do yourself a favor and READ the documentation,
DON'T just scan it looking for a quick answer. You are bound to miss
something important.
Turns out that for all my struggling with a db name for mysql, all that
came after I had changed the settings.py to mysql. In other words, I didn't
think to go back and put the name I came up with, django_1, in settings.py.
But that was not enough. Now I had to also take off the
'--database=django_1' as that was unnecessary and maybe confusing django.
Once I did that, it all worked.

But don't worry, I'm sure I'll be back soon enough with some other
issues. :-)


On Wed, Feb 5, 2014 at 7:44 PM, Ariel E. Isidro  wrote:

> 1. before exiting mysql, you should grant permission to a user,i.e.
> grant all privileges on django_1.* to username@'localhost' identified by
> 'userpassword'
> replace username, userpassword with your own
> 2. exit mysql console
> 3. modify settings.py to add your username, password, host (localhost),
> and port (3306)
> 4. run python manage.py syncdb
>
>
> On Thu, Feb 6, 2014 at 7:52 AM, Drew Ferguson wrote:
>
>> Hi
>>
>> Just like SQLlite, you tell Django where the MySQL database is in
>> settings.py
>>
>> At the top you should have something like
>>
>> DATABASES = {
>>  'default': {
>>   'ENGINE': 'django.db.backends.mysql',
>>   'NAME': 'django_1', # Or path to database file if using sqlite3.
>> #  'USER': '',
>> #  'PASSWORD': '',
>> #  'HOST': '', # Empty for localhost
>> #  'PORT': '', # Set to empty string for default.
>>  }
>> }
>>
>>
>> On Wed, 5 Feb 2014 16:38:59 -0600
>> Malik Rumi  wrote:
>>
>> > mysql>  CREATE DATABASE django_1;
>> >
>> > Query OK, 1 row affected (0.24 sec)
>> >
>> > mysql> SHOW DATABASES;
>> >
>> > ++
>> >
>> > | Database   |
>> >
>> > ++
>> >
>> > | information_schema |
>> >
>> > | django_1   |
>> >
>> > | mysql  |
>> >
>> > | performance_schema |
>> >
>> > | test   |
>> >
>> > ++
>> >
>> > 5 rows in set (0.31 sec)
>> --
>> Drew Ferguson
>> AFC Commercial
>> http://www.afccommercial.co.uk
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/20140205235235.53a238b1%40blacktav.fergiesontour.org
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> *Ariel E. Isidro*
> Backup your important files, click here  
>
> DISCLAIMER: This message is for the designated recipient only and may
> contain confidential and/or privileged information. If you have received it
> in error, please delete it and advise the sender immediately. You should
> not copy or use it for any other purpose, nor disclose its contents to any
> other person.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/zpNqaA2Fji8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAECOjiaW4jswaift33tcdTJc5DBwFYJhRKyZPmhn7FToC8QUvw%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKd6oBxrfndqFf0t7vOsXrnTzWP5_UMYbeZr3RYvdri2jSu%3Dug%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Checkboxes collection instead of a multiple select

2014-02-06 Thread Tom Evans
On Thu, Feb 6, 2014 at 11:15 AM, Jonathan Querubina
 wrote:
> Hi guys,
>
> How do i show a collection of checkboxes instead of a multiple select?
>
> Thanks!

Sounds like you want to change the widget on a form:

https://docs.djangoproject.com/en/1.6/ref/forms/widgets/

Specifically, changing it from a SelectMultiple widget to a
CheckboxSelectMultiple:

https://docs.djangoproject.com/en/1.6/ref/forms/widgets/#checkboxselectmultiple

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1%2B7xxQYugLU8M%3DBq58pbfyZhF1WAHa31NpJr1xDsxcKgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Matrimonial Apps,

2014-02-06 Thread Esau Rodriguez
What do you mean by "matrimonial apps"?



On Thu, Feb 6, 2014 at 2:18 PM, Puneet  wrote:
> Guys did you anything on this ? I am looking for one matrimonial app in
> django.
>
> On Saturday, August 14, 2010 5:05:51 PM UTC+5:30, Kenneth Gonsalves wrote:
>>
>> On Sat, 2010-08-14 at 12:28 +0100, Rizwan Mansuri wrote:
>> > I belies in open sources 100%. Anything what I will write would be
>> > 100% open
>> > source.
>>
>> in which case - where is the code - I would like to join
>> --
>> regards
>> Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ed1e6077-4d0b-41d7-a27f-4b8a01d95cca%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
Esaú Rodríguez
esa...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB4Jw749%2BGeCdX%2B-ngt6T2pGO3N7_KBg5x1HLJSfxsBnSzDNEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Matrimonial Apps,

2014-02-06 Thread Puneet
Guys did you anything on this ? I am looking for one matrimonial app in 
django. 

On Saturday, August 14, 2010 5:05:51 PM UTC+5:30, Kenneth Gonsalves wrote:
>
> On Sat, 2010-08-14 at 12:28 +0100, Rizwan Mansuri wrote:
> > I belies in open sources 100%. Anything what I will write would be
> > 100% open
> > source. 
>
> in which case - where is the code - I would like to join
> -- 
> regards
> Kenneth Gonsalves
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ed1e6077-4d0b-41d7-a27f-4b8a01d95cca%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: tutorial p.6 problem: style.css isn't loaded

2014-02-06 Thread Janek Warchoł
Hi,

W dniu czwartek, 6 lutego 2014 04:48:42 UTC+1 użytkownik Daniel Sears 
napisał:
>
> templates/admin isn't necessary. Instead you should extend both TEMPLATE_DIRS 
> and STATICFILES_DIRS to include the templates and static files for the 
> admin package
>

Well, templates/admin/base_site.html was actually a modified version of the 
original template.  Admittedly, index.html is redundant.

As for the css problem, everything works today and i have no idea why it 
didn't yesterday - i haven't changed anything.

best,
Janek 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9d589a81-fa12-4ce7-80a1-00c1c9e2d000%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Trouble in trying django form wizard example!

2014-02-06 Thread Tomas Vician
Dear Dilip,

Did you solve this issue? I have same problem and I dont know what to do.

Tomas

On Tuesday, March 5, 2013 10:33:36 AM UTC+1, Dilip M wrote:
>
> Hi,
>
> I am new to Django and trying out form wizards. I am trying the example 
> mentioned in 
>
> https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/#wizard-template-for-each-form
> .
>
> After 'submit'ting the data for 'ContactForm1' I am not getting 
> 'ContactForm2'? 
>
> I am just trying to print the date I key in ContactForm1 and ContactForm2 
> in some sample template!
>
>
>
> Please help!
>
> Thanks, Dilip
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9dbe5f7f-f87e-4736-8716-92601e8d29d4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Checkboxes collection instead of a multiple select

2014-02-06 Thread Jonathan Querubina
Hi guys,

How do i show a collection of checkboxes instead of a multiple select?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c513dd55-e0d4-4f8e-8c05-f45b3bc83814%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Optimizing DB query involving annotate and aggregate

2014-02-06 Thread ST
On Wednesday, February 5, 2014 8:01:53 PM UTC, Anssi Kääriäinen wrote:
>
> Something like this might work:
> 
> Transaction.objects.values_list('member_id').annotate(total=Sum('amount')).filter(total__gt=0).aggregate(Sum('total'))
>

This didn't work - it produced a "SELECT  FROM" query, which obviously 
didn't work - tried adding 'amount' to the values_list, but that didn't 
help either. Eventually got it to work by using .only('member', 'amount') 
instead, and it *was* fast, but it didn't quite do what we need: we only 
want the *outstanding* credit/debt, i.e. some member might have many 
transactions, but they all add up to zero - so instead of increasing both 
total_debt and total_credit by that value, it shouldn't affect the totals. 
Which is why I wanted to total up by members first... any idea how to get 
that to work ?

 

>
> That is, don't start from Member, Django isn't smart enough to get rid of 
> the non-necessary joins. Instead go directly for the query you wrote in 
> SQL. In the ORM .values() is the way to control GROUP BY clause. Getting 
> the order of .values() and .annotate() right is important, and it is 
> sometimes hard to figure out how to do it correctly. Also, if you have some 
> extra ordering going on in the query just issue an empty .order_by() call - 
> that will get rid of all ordering.
>
>  - Anssi
>
> On Wednesday, February 5, 2014 8:11:29 PM UTC+2, ST wrote:
>>
>> Hi,
>>
>> I'm trying to optimize the run-time of getting total credit and debt 
>> values out of our database. Ideally I'd like to formulate it as a Django 
>> query. This is the raw SQL query I have, which produces the right answer 
>> and is very fast (milliseconds):
>>
>> SELECT sum(tg.total) FROM
>>   (
>>   SELECT sum(t.amount) AS total, t.member_id AS member_id
>>   FROM club_transaction AS t
>>   WHERE t.member_id IS NOT NULL
>>   GROUP BY t.member_id
>>   ) AS tg
>> WHERE tg.total < 0
>>
>> (plus a second query for > 0)
>>
>> My Django implementation was:
>>
>> m = Member.objects.annotate(balance=Sum('transaction__amount'))
>> m_debt = m.filter(balance__lt=0).aggregate(total=Sum('balance'))
>> m_credit = m.filter(balance__gt=0).aggregate(total=Sum('balance'))
>>
>> which looks a lot nicer, is easier to understand and maintain.
>>
>> However, it results in the following SQL query (slightly redacted):
>>
>> SELECT SUM(balance) FROM
>>   (
>>   SELECT "club_member"."id" AS "id", {all the other fields}, 
>> SUM("club_transaction"."amount") AS "balance"
>>   FROM "club_member"
>>   LEFT OUTER JOIN "auth_user" ON ("club_member"."user_id" = 
>> "auth_user"."id")
>>   LEFT OUTER JOIN "club_transaction" ON ("club_member"."id" = 
>> "club_transaction"."member_id")
>>   GROUP BY "club_member"."id", {all the other fields}, 
>> "auth_user"."last_name", "auth_user"."first_name"
>>   HAVING SUM("club_transaction"."amount") < 0
>>   ORDER BY "auth_user"."last_name" ASC, "auth_user"."first_name" ASC
>>   ) subquery
>>
>> (again, plus another one for > 0)
>> which is very slow (almost 1.5 seconds).
>>
>> How can I construct a Django query which doesn't request (and group by) 
>> all the unnecessary other fields ?
>> I already tried playing around with only() and values() but never got it 
>> to work.
>>
>> Looking forward to your responses!
>>
>> best regards,
>> ST
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3e239afe-037c-4ace-b9eb-ac2404f75981%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: url error

2014-02-06 Thread Cristiano Araujo
yeah, i found the error. just a slash unnecessary

url(r'^tag/(?P\w+)$', 'tagpage'),

 url(r'^tag(?P\w+)$', 'tagpage'),
^


On Thu, Feb 6, 2014 at 3:52 AM, Babatunde Akinyanmi wrote:

> Ji Cristiano.  You show the code that is not behaving as you expect
> On 6 Feb 2014 03:15, "Cristiano Araujo"  wrote:
>
>> the message error:
>>>
>>
>> Using the URLconf defined in webapp.urls, Django tried these URL
>> patterns, in this order:
>>
>>1. ^blog/ ^$
>>2. ^blog/ ^(?P\d+)$
>>3. ^blog/ ^archives/$
>>4. ^blog/ ^tag/(?P\w+)$
>>5. ^blog/ ^feed/$
>>6. ^admin/
>>
>> The current URL, blog/tagLondon, didn't match any of these.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/f6b64738-fb29-4bd1-86c1-4c30dd1992a8%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/3eX9CDLmNE4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BWjgXMb8s%2BQqfodiwSu4d2X%3Dy_v-pYYnSm5ZnRBpQ5KtNrmaQ%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



--

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BZNuF9TPV-NF3U7tH0HHB3vrEn-G%3DWQwPu-ahn9C3vKYEZh4A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Need help on token-based authentication

2014-02-06 Thread Calvin Chen
Hi Rahul Gaur,

Thanks for your answer.
I will definitely take a look at the gist and repositories that you 
provided. 
Hopefully, it will gives me some ideas. :-)

Thanks a lot.

Kind Regards,
Cheng

On Thursday, February 6, 2014 6:03:03 PM UTC+8, Rahul Gaur wrote:
>
> Hi , 
> You can take a look at the following GIST : 
> https://gist.github.com/aregee/6310787 
> I have two projects , that implement the Token based authentication.
> I have used Django Tastypie for rolling out the RESTful apis and since 
> tastypie offers ApiKeyAuthentication() method , on the client side I have 
> used AngularJS. My gist link contains factory session service for angularJs 
> that stores the user details ie: Api Key and username in the browser cache.
> For every request the angular code makes to server , it appends the api 
> key to headers.
>
> Code quality is not really very great , but I think you can get a brief 
> idea.
> Let me know if you have any questions.
>
> Project Repos : 
> https://github.com/aregee/moksaya
> https://github.com/aregee/musicstore
>
> Regards, 
> Rahul 
>
>
> On Thu, Feb 6, 2014 at 2:35 PM, Calvin Chen  > wrote:
>
>> Hi,
>>
>> I couldn't find any real example about how to use token-based 
>> authentication in Django, and how to let it work with front-end MVC 
>> framework like AngularJS.
>> Do you guys have any ideas?
>>
>> Kind Regards,
>> Calvin
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/bf839d9c-c92e-4206-a5c7-a01ce1ee556d%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
>
> ---
> Rahul Gaur
> irc : iamaregee2
> Web: http://www.rahulgaur.info
> Github: https://github.com/aregee 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/007f6528-9a2a-4f72-bb47-c4d7f171b1f6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Need help on token-based authentication

2014-02-06 Thread Rahul Gaur
Hi ,
You can take a look at the following GIST :
https://gist.github.com/aregee/6310787
I have two projects , that implement the Token based authentication.
I have used Django Tastypie for rolling out the RESTful apis and since
tastypie offers ApiKeyAuthentication() method , on the client side I have
used AngularJS. My gist link contains factory session service for angularJs
that stores the user details ie: Api Key and username in the browser cache.
For every request the angular code makes to server , it appends the api key
to headers.

Code quality is not really very great , but I think you can get a brief
idea.
Let me know if you have any questions.

Project Repos :
https://github.com/aregee/moksaya
https://github.com/aregee/musicstore

Regards,
Rahul


On Thu, Feb 6, 2014 at 2:35 PM, Calvin Chen  wrote:

> Hi,
>
> I couldn't find any real example about how to use token-based
> authentication in Django, and how to let it work with front-end MVC
> framework like AngularJS.
> Do you guys have any ideas?
>
> Kind Regards,
> Calvin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bf839d9c-c92e-4206-a5c7-a01ce1ee556d%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
---
Rahul Gaur
irc : iamaregee2
Web: http://www.rahulgaur.info
Github: https://github.com/aregee

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANijKx3WZ5VT--KpyuZyTgO8v7hyVcHb46H48%2BjDh0CbyYbmXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Need help on token-based authentication

2014-02-06 Thread Calvin Chen
Hi,

I couldn't find any real example about how to use token-based 
authentication in Django, and how to let it work with front-end MVC 
framework like AngularJS.
Do you guys have any ideas?

Kind Regards,
Calvin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bf839d9c-c92e-4206-a5c7-a01ce1ee556d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.