[web2py:14656] SQLForm Level Validation -> Best Practices?

2009-01-07 Thread Manakel
Hello All, I'm just discovering web2py and i'm not able to wrap my mind about the Form level validation inside it. Let's say we talk about a defect. This defect has a "Fixing Date" (date where provider deliver the fixing code in integration system) and a "Closing Date" (date where the customer c

[web2py:14678] Re: SQLForm Level Validation -> Best Practices?

2009-01-07 Thread Manakel
  def __call__(self,value): >          if valid value: return (value,None) >         else: return (value, error_message) > > On Jan 7, 2:22 am, Manakel wrote: > > > Hello All, > > > I'm just discovering web2py and i'm not able to wrap my mind about the > >

[web2py] Unable to define the right query to get the first matching record of each category in a group by expression

2011-11-29 Thread Manakel
Hello, I'm writing my first app with Web2py. So far, i'm very impressed. But i'm facing a problem of query design: I have the following model for "operations" DATE BUDGET TITLE AMOUNT where the possible values for budget are defined in a "budget_types" table (budget is a reference field) I need

[web2py] Re: Unable to define the right query to get the first matching record of each category in a group by expression

2011-11-29 Thread Manakel
nsualité No... 980.0 and not the ID BUDGET AMOUNT DATE TITLE 8 LOGEMENT_PRET 990.0 2011-11-28 AGIO PRETS 120.0 On 29 nov, 17:27, Manakel wrote: > Hello, > > I'm writing my first app with Web2py. > So far, i'm very impressed. > But i'm facing a problem o

[web2py] Re: Unable to define the right query to get the first matching record of each category in a group by expression

2011-11-29 Thread Manakel
Hello, Simply adding the last() at the end does not work. It gives me the last operation of the full request (whatever the budget) But i need each last operation for each budget. On 29 nov, 17:43, monotasker wrote: > If you just need the last row from your (ordered) select object, you can > ju

[web2py] Re: Unable to define the right query to get the first matching record of each category in a group by expression

2011-11-30 Thread Manakel
Hello, Thanks for the help. I'll perform the request in 2 steps to achieve the results. On 30 nov, 04:09, monotasker wrote: > When I've done date-related operations I've had to use the python datetime > and calendar modules. They're both in the standard library so you can just > do "import date

[web2py] How to get the only the value of the Sum in a sum Query?

2011-11-30 Thread Manakel
Hello, I have the following models for "Operations". db.define_table('operations',Field('date','date'),Field('budget',db.budgets),Field('title','string'),Field('amount','double'),format='% (budget)s-%(amount)d-%(date)s:%(title)s') I'm performing the following query to get the total amount of ope

[web2py] Re: How to get the only the value of the Sum in a sum Query?

2011-12-01 Thread Manakel
Great, i believe it clarifies a lot of misunderstanding from my side :-). Basically, correct me if am wrong: - the query is only evaluated at the time of the "select". - we can create "query" object for both parts of the query and assemble them and they 'll be evaluated at the time of the "select"

[web2py] How to define a central validation (enforced for any controller/view) for a model?

2011-12-01 Thread Manakel
Hello, Here is the use case. I have 2 Entities A & B (Models) that can be linked together using a m2m relationships in a "link" table. the 2 Entities each have a 'category' field and there are some business rules like Items of A with category C1 are not allowed to be linked to Items of B with cate

[web2py] How to Query on "related" fields ?

2011-12-01 Thread Manakel
Hello, I have a model with 2 tables with a "reference" relationship between the two. => the Budget has a type and the name/attributes of this type are defined in the budget_types table. Now in a query on the budget table i would like to retrieve the name of the Budget type and not the Budget Type