On Tue, Oct 24, 2006 at 10:46:21PM -, Ed wrote:
> What do you mean when you say that the data is not 'normalized'?
I'm referring to database normalization, which boils down to: store
each piece of data in only one spot. Check here:
http://en.wikipedia.org/wiki/Database_normalization or Google
Hi John, thanks for your introduction to django dispatchers. I think
this is a greatly overlooked facility and has many applications.
> 1- signals. Benefits: it works with all dbs (supported by django), the
> fields are sortable using the api. Drawbacks: you can't use non-django
> code to do dat
On Tue, Oct 24, 2006 at 02:28:43PM +0200, Carlos Yoder wrote:
> While I believe this mini tutorial on signals is great, I guess this
> functionality would be better accomplished in the DB itself, via a
> trigger.
There are, i think, three ways of doing what was asked for:
1- signals. Benefits: i
While I believe this mini tutorial on signals is great, I guess this
functionality would be better accomplished in the DB itself, via a
trigger.
On 10/16/06, MerMer <[EMAIL PROTECTED]> wrote:
>
> John,
>
> Excellent. The requirement to make it easily sortable makes your
> solution compelling.
John,
Excellent. The requirement to make it easily sortable makes your
solution compelling. Thanks for detailing. Plus Im sure that there will
lots of places where this type of Signals method would be handy.
MerMer
--~--~-~--~~~---~--~~
You received this messag
On Sun, Oct 15, 2006 at 01:26:18PM -0700, MerMer wrote:
> I have two Models.
>
> 1. Product
> 2. Review - There can be many reviews for any product (one -to many
> relationship)
>
> One of the fields of Review is "Rating". This holds an integer between
> 1 and 5.
>
> I want to display a lis
> Any suggestions on how would you get the server to calculate
> and return the average?
Though I believe someone else already answered this, Django
allows you to fire off live SQL queries, which can do things like
SELECT AVERAGE(column_name1)
FROM tblTable
which will just return the average o
Tim,
Many thanks - that has helped me understand alittle more about Python.
I'm sure that there is a faster way. It's been more of an exercise
for me to try and get to understand Django, Python etc. I'm practically
a complete newbie.
Any suggestions on how would you get the server to calculate
>def av_rating(self):
> queryset = self.review_set.all()
> x=0
> y=0
> for rating in queryset:
> x=x+rating.rating
> y=y+1
> return x/y
>
> {{ objects.av_rating }} is the tag that is then put in the te
Looking at the options, I've also experimented with creating a custom
Model method.
The following almost works ( The division at the end returns an error
and I'm new at Python so need to work that out)
def av_rating(self):
queryset = self.review_set.all()
x=0
On 10/16/06, MerMer <[EMAIL PROTECTED]> wrote:
>
> Jonathan,
>
> I don't want to the list to be filtered to only those who have a
> Rating. I need to display ALL the products, while still showing the
> average rating for those products which have a rating.
>
> Example Table:
>
> -- Pr
Jonathan,
I don't want to the list to be filtered to only those who have a
Rating. I need to display ALL the products, while still showing the
average rating for those products which have a rating.
Example Table:
-- Price --- # Reviews ---Average Rating
Product 1 $24
> Jonathan,
>
> Many thanks for this.
>
> Sorry to be a pain , but I have a couple of follow on questions, so I'm
> clear.
>
> 1. How should I best implement this code. As a custom tag or in the
> view?
>
> 2. Any suggestions on how I should pass the product.id to the code?
>
> Thanks
>
> MerMer
Jonathan,
Many thanks for this.
Sorry to be a pain , but I have a couple of follow on questions, so I'm
clear.
1. How should I best implement this code. As a custom tag or in the
view?
2. Any suggestions on how I should pass the product.id to the code?
Thanks
MerMer
--~--~-~--~---
On 10/15/06, MerMer <[EMAIL PROTECTED]> wrote:
>
> I have two Models.
>
> 1. Product
> 2. Review - There can be many reviews for any product (one -to many
> relationship)
>
> One of the fields of Review is "Rating". This holds an integer between
> 1 and 5.
>
> I want to display a list of Produ
15 matches
Mail list logo