Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
ter(num_messages__gt = 1) But results vary with the query in my first statement. Or, maybe i'm not doing it right. On 19 янв, 14:58, "[CPR]-AL.exe" <cpr.al@gmail.com> wrote: > Oh, no, that wouldn't work with CharField. Or, maybe I'm doing > something wrong. > > About a

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
Oh, no, that wouldn't work with CharField. Or, maybe I'm doing something wrong. About a queryset - I mistaken aggregate() for annotate(). On 19 янв, 14:52, "[CPR]-AL.exe" <cpr.al@gmail.com> wrote: > Wait, wat... o.O I'l try that now, thx. > > > > > >

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
Wait, wat... o.O I'l try that now, thx. On Wed, Jan 19, 2011 at 2:50 PM, Tom Evans <tevans...@googlemail.com> wrote: > On Wed, Jan 19, 2011 at 11:26 AM, [CPR]-AL.exe <cpr.al@gmail.com> > wrote: > > Hmm, yeah, but that still iterates over the objects and filte

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
hen whilst iterating over > that, if you need to grab the ORM'd row, just do "row_orm = > model.get(id=iterated_id_here)" > > This is what I tend to do for raw sql queries. > > > > > > > > On Wed, Jan 19, 2011 at 11:26 AM, [CPR]-AL.exe <cpr.al

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
ill > purposely bypass the ORM at bottlenecks and directly query SQL for > optimization. > > > > > > > > On Wed, Jan 19, 2011 at 11:07 AM, [CPR]-AL.exe <cpr.al@gmail.com> wrote: > > Umm... Don't know, actually. That seems, that it would be okay, too.

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
T id from table GROUP BY tablefield HAVING (COUNT(tablefield) > 1) > > On Wed, Jan 19, 2011 at 11:02 AM, [CPR]-AL.exe <cpr.al@gmail.com>wrote: > >> Hi there. >> >> I'm trying to do something like this: >> >> SELECT * >> FROM table >> WHERE t

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
To make it more clear: I have something like a forum and want to find duplicate messages (meaing the message field should be identical) to create a report for the moderator. On 19 янв, 14:02, "[CPR]-AL.exe" <cpr.al@gmail.com> wrote: > Hi there. > > I'm tr

Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
Hi there. I'm trying to do something like this: SELECT * FROM table WHERE tablefield IN ( SELECT tablefield FROM table GROUP BY tablefield HAVING (COUNT(tablefield ) > 1) ) Tried it in many ways, but didn't suceed. Is there a way to do it with Django ORM without having to iterate over

Anyway to render a template without inheritance?

2009-06-22 Thread [CPR]-AL.exe
Hello. Is there any way to render a template, omitting the "extends" tag? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To

ImageField form validation doesn't work.

2009-05-25 Thread [CPR]-AL.exe
Hello. I have a simple form with only ImageField declared in it and I've got the following problem: when I am trying to upload something that is not am image, i get no errors at all. Form.is_valid() returns True. What should I do to validate the imagedata?

Re: MultiValueField with required=True problem

2009-05-20 Thread [CPR]-AL.exe
I understood that, i just thought there is some nicer way to do it :) Thx. On Wed, May 20, 2009 at 11:52 PM, Sam Chuparkoff <s...@sadach.org> wrote: > > On Wed, 2009-05-20 at 07:09 -0700, [CPR]-AL.exe wrote: > > So, what is the best way to throw a ValidationError only if

Re: MultiValueField with required=True problem

2009-05-20 Thread [CPR]-AL.exe
So, what is the best way to throw a ValidationError only if None of values a entered in subclassed field? On 19 май, 23:10, Sam Chuparkoff <s...@sadach.org> wrote: > On Mon, 2009-05-18 at 10:13 -0700, [CPR]-AL.exe wrote: > > I've created a field+widget set that i use to

Re: MultiValueField with required=True problem

2009-05-19 Thread [CPR]-AL.exe
It is required On 19 май, 08:05, Thierry <lamthie...@gmail.com> wrote: > Isn't required the default behaviour of Field: > > http://docs.djangoproject.com/en/dev/ref/forms/fields/ > > From the above code, TextInput is required: > > forms.TextInput(), > > On May 18

Re: MultiValueField with required=True problem

2009-05-19 Thread [CPR]-AL.exe
above code, TextInput is required: > > forms.TextInput(), > > > On May 18, 1:15 pm, "[CPR]-AL.exe" <cpr.al@gmail.com> wrote: > > class CheckboxSelectWithTextInputWidget(forms.MultiWidget): > > > > def __init__(self,choices, attrs=None): &g

Re: MultiValueField with required=True problem

2009-05-18 Thread [CPR]-AL.exe
class CheckboxSelectWithTextInputWidget(forms.MultiWidget): def __init__(self,choices, attrs=None): widgets = ( forms.CheckboxSelectMultiple(choices = choices), forms.TextInput(), ) super(CheckboxSelectWithTextInputWidget,self).__init__

MultiValueField with required=True problem

2009-05-18 Thread [CPR]-AL.exe
Hello there. I've created a field+widget set that i use to render a number of checkboxes and a TextInput with comma-separated values. The problem is, when i set required = True, I get a ValidationError if only checkboxes are selected (but i don't get it if TextInput is filled) Here are the

Re: ManyToOne : cannot form a proper query :(

2009-03-09 Thread [CPR]-AL.exe
Oh, nevermind, i figured out how to make nested joins only with q objects! On 9 мар, 17:26, "[CPR]-AL.exe" <cpr.al@gmail.com> wrote: > Thanks, but i thought that there's some django-way to do such a > thing... is there a way i can add raw SQL query to Q object? That wil

Re: ManyToOne : cannot form a proper query :(

2009-03-09 Thread [CPR]-AL.exe
> <http://docs.djangoproject.com/en/dev/topics/db/sql/ > > > if needed. > > On Mar 5, 4:25 am, "[CPR]-AL.exe" <cpr.al@gmail.com> wrote: > > > So, it seems, that there is no way to do what i want? > > --~--~-~--~~~---~--~~ You r

Re: ManyToOne : cannot form a proper query :(

2009-03-05 Thread [CPR]-AL.exe
So, it seems, that there is no way to do what i want? On 3 мар, 19:17, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Tue, Mar 3, 2009 at 11:13 AM, [CPR]-AL.exe <cpr.al@gmail.com> wrote: > > > for example, i have this models: > > (like here:http://www.djangopr

Re: ManyToOne : cannot form a proper query :(

2009-03-04 Thread [CPR]-AL.exe
Thanks, but i've already read that and there's no answer for my question. In SQL this would be some query with nested joins.. but i don't know how to make this query in django.. On 3 мар, 19:17, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Tue, Mar 3, 2009 at 11:13 AM, [CPR]-AL.ex

Re: ManyToOne : cannot form a proper query :(

2009-03-03 Thread [CPR]-AL.exe
Ooops, mean "How", not "Who" ... srry... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send

Re: ManyToOne : cannot form a proper query :(

2009-03-03 Thread [CPR]-AL.exe
Mean, "two reporters", of course --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to

ManyToOne : cannot form a proper query :(

2009-03-03 Thread [CPR]-AL.exe
for example, i have this models: (like here: http://www.djangoproject.com/documentation/models/many_to_one/) from django.db import models class Reporter(models.Model): first_name =