How do I execute custom sql in a test right after the database is created?

2014-05-16 Thread John Rambo
First of all I know that is bound to break a lot of other things.

I changed the core so references to tables are PostgreSQL fully qualified 
table name (e.g. "family"."person" instead of family_person). So far it had 
been doing what I want except I can't run tests because the schemas are not 
created in a new database.

How would I run arbitrary SQL right after the test database is created so I 
can create the schemas?

Thanks,

JR

-- 
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/55ab1eea-6c78-4af8-90a6-1eff42e99b0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


distinct().filter() applies filter before distinct

2014-06-10 Thread John Rambo
 

If we chain a call to filter() after a call to distinct(), the filter is 
applied to the query before the distinct. How do I filter the results of a 
query *after* applying distinct?

Example.objects.order_by('a','b').distinct('a').filter(b='something)

The where clause in the SQL resulting from filter() means the filter is 
applied to the query before the distinct. I want to filter the queryset 
resulting from the distinct.

This is probably pretty easy, but I just can't quite figure it out and I 
can't find anything on it.

Another way to ask the question is how do I return a distinct QuerySet and 
then filter 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/f0e4bccc-2de6-4018-bd48-d3573ad60e6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: distinct().filter() applies filter before distinct

2014-06-10 Thread John Rambo
This better illustrates what I mean:

Example.objects.order_by('a','foreignkey__b').distinct('a').filter(foreignkey__b='something')

On Tuesday, June 10, 2014 4:06:50 PM UTC-5, John Rambo wrote:
>
> If we chain a call to filter() after a call to distinct(), the filter is 
> applied to the query before the distinct. How do I filter the results of a 
> query *after* applying distinct?
>
> Example.objects.order_by('a','b').distinct('a').filter(b='something)
>
> The where clause in the SQL resulting from filter() means the filter is 
> applied to the query before the distinct. I want to filter the queryset 
> resulting from the distinct.
>
> This is probably pretty easy, but I just can't quite figure it out and I 
> can't find anything on it.
>
> Another way to ask the question is how do I return a distinct QuerySet and 
> then filter 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/0fe9ac9a-60c5-480f-b7d3-0db32b0a0f3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to use 1.7 from git repository

2014-06-23 Thread John Rambo
How do I switch to version 1.7 in git when I have the current repository?

-- 
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/3841c692-30e4-4615-b428-3117b3e6e5bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Can't run tests when admin is part of INSTALLED_APPS?

2014-06-24 Thread John Rambo
If I try to run test suites in 1.7 with admin in INSTALLED_APPS, I get 
this...

  File "/django/core/management/commands/migrate.py", line 195, in 
model_installed
(opts.auto_created and converter(opts.auto_created._meta.db_table) in 
tables))
AttributeError: 'bool' object has no attribute '_meta'

If I comment out the django.contrib.admin, tests work fine.

I do not know how to dig further from here. Is anyone able to point me in 
the right direction?

-- 
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/31e83a94-6520-41a0-b881-c0806f954bde%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.