Makes sense, I probably should have realized this from the beginning.

Appreciate the help.

On Monday, September 20, 2021 at 6:17:05 PM UTC-5 Sean wrote:

> Add a property to count Y for each column
>
> Or add a computed field that tallies that on save 
>
> For reference
>
>
> https://stackoverflow.com/questions/1454727/do-properties-work-on-django-model-fields
>
>
> On Mon, Sep 20, 2021 at 6:41 PM J.T. <[email protected]> wrote:
>
>> I have a model called member that has 6  columns: ID, Value1, Value2, 
>> Value3, Value4, Value5
>>
>> The values in columns Value1, Value2, Value3, Value4, Value5 are either Y 
>> or N.
>>
>> I'm trying to query by ID to count the number of Y values for each member.
>>
>> For example one row would be: 5, Y, N, Y, N, N
>>
>> I would like to return: 2 (since that is the number of Y in that member's 
>> row)
>>
>> I've tried using Aggregate, Annotate, F, Q, Sum, Count in different ways 
>> and I'm missing the mark. I've been through the docs and SO for about 2 
>> hours.
>> I would post my errors but it's on my work computer and I have to post 
>> here from my personal laptop.
>>
>> I feel like I may be over-thinking it but I can't quite figure it out. 
>> Any help would be greatly appreciated. 
>>
>> Jason
>>
>>
>> -- 
>> 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 [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/597a0acf-65a0-4e9a-8a9f-b61892860789n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/597a0acf-65a0-4e9a-8a9f-b61892860789n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b9f48d2e-acd7-44e0-b8d9-0fa348443f48n%40googlegroups.com.

Reply via email to