On 09/14/2011 11:37 AM, Иван Иванов wrote:
The problem here is, like Peter said, that you cannot order before
grouping. And that's very annoying.
Of course you can, using a subselect just like I showed. SQLite example:
> .schema
CREATE TABLE a (name varchar, mod int);
e> select * from a;
b1|1
On 09/14/2011 04:35 AM, Peter of the Norse wrote:
What are you trying to do? The outer GROUP BY destroys the inner ORDER BY. Try
putting them on the same level and see what happens.
Say I've got an Event table and some records like this
name: foo, timestamp: 9 pm
name: foo, timestamp: 10p
Hi!
How can I express this SQL query
SELECT ... FROM (
SELECT ... FROM ...
)
in the ORM? Specifically, I want to express
SELECT ... FROM (
SELECT ... FROM app_model
ORDER BY field1
)
GROUP BY field2
Is it possible without writing SQL by hand?
Thanks,
Jonas
--
Django +
On 08/14/2011 09:57 PM, bruno desthuilliers wrote:
{% for current, entry, month, n in months %}
Please think about what "months" is here... Yes, a list of dicts. So
this line is the equivalent of:
current = months[0] # first dict in the list
entry = months[1]# second dict in the list
month
On 08/13/2011 05:00 PM, Karen Tracey wrote:
Plus, afaik, fields can not access form instances so this code would have
to live in the form subclass -- not practical in my use case.
Where I have done this (reluctantly) has been in the form (or perhaps it was
the field) clean method, where self is
On 08/13/2011 06:33 AM, Karen Tracey wrote:
On Thu, Aug 11, 2011 at 7:03 AM, Jonas H. wrote:
On 08/09/2011 12:45 AM, Jonas H. wrote:
Hello list!
Is there any way to use a different value for a field when re-displaying
a form? I.e. if a user enters '42' into an IntegerField bu
On 08/09/2011 12:45 AM, Jonas H. wrote:
Hello list!
Is there any way to use a different value for a field when re-displaying
a form? I.e. if a user enters '42' into an IntegerField but made the
other fields not validate, how could that IntegerField be re-displayed
with '43
Hello list!
Is there any way to use a different value for a field when re-displaying
a form? I.e. if a user enters '42' into an IntegerField but made the
other fields not validate, how could that IntegerField be re-displayed
with '43'?
Jonas
--
You received this message because you are subs
On 12/19/2010 10:20 PM, Andy wrote:
Is there a way to specify JOIN using the Django ORM? The 2 tables I'm
joining aren't related through a foreign key.
Why don't you use a relation field in your models if your models are
related?
--
You received this message because you are subscribed to the
On 12/19/2010 09:45 PM, Andy wrote:
I need to execute some SQL queries involving joins and it seems like
custom SQL is the way to go.
I presume you already tried out to do your JOIN queries using the Django
ORM?
A couple of questions:
1) In the doc (http://docs.djangoproject.com/en/1.2/
On 12/18/2010 10:59 AM, sami nathan wrote:
__init__() must be called with TypeCode instance as first argument
(got String instance instead) what this error says when i overriden
the ZSI server file i got this error is there any one to say what this
error says
* Do not open a second thread with
On 12/18/2010 10:30 AM, Łukasz Rekucki wrote:
On 18 December 2010 03:43, suckerfish wrote:
Hi guys
I've added a decorator to *each* def in views.py to require
authentication. Is there a simpler way that allows me to apply
authentication automatically to every def in the file?
Depends on your
On 12/17/2010 08:38 PM, Łukasz Rekucki wrote:
Blog.objects.filter(post_tags__name__in=["foo",
"bar"]).annotate(match_count=Count('post__tags')).filter(match_count=2)
This should give you the right results.
Neat! And blazingly fast, too, I guess!
Thank you very much, anyway :-)
Jonas
--
You
On 12/17/2010 10:18 PM, hank23 wrote:
Is data entered on an input screen automatically added to the request
when the screen is submitted? If so are there any special parameters
or settings in the screen controls which have to be set/coded to get
the entered data saved into the request and under w
On 12/17/2010 08:21 PM, Javier Guerra Giraldez wrote:
Blog.objects.filter(post__tags__name="foo").filter(post__tags__name="bar")
That's "get all blogs that have at least one post tagged with 'foo' and
one post tagged with 'bar'", not requiring that *one post* matches
*both* conditions.
--
Y
Hello!
Assuming the following data model:
+--++--+ +-+
| Blog | has many (1:n) | Post | tagged with (n:m) | Tag |
+--++--+ +-+
I want to filter out all blogs that have a post tagged with "foo" and
"bar"
16 matches
Mail list logo