Schemas
            SimpleClubSchema
¶
    
              Bases: ModelSchema
            GroupSchema
¶
    
              Bases: ModelSchema
            SimpleUserSchema
¶
    
              Bases: ModelSchema
A schema with the minimum amount of information to represent a user.
            Counter
¶
    
              Bases: Model
            gen_token()
¶
    
            barmen_list()
¶
    
            get_random_barman()
¶
    
            update_activity()
¶
    
            can_refill()
¶
    Show if the counter authorize the refilling with physic money.
Source code in counter/models.py
              
            get_top_barmen()
¶
    Return a QuerySet querying the office hours stats of all the barmen of all time of this counter, ordered by descending number of hours.
Source code in counter/models.py
              
            get_top_customers(since=None)
¶
    Return a QuerySet querying the money spent by customers of this counter since the specified date, ordered by descending amount of money spent.
Each element of the QuerySet corresponds to a customer and has the following data :
- the full name (first name + last name) of the customer
 - the nickname of the customer
 - the amount of money spent by the customer
 
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                since
             | 
            
                  datetime | date | None
             | 
            
               timestamp from which to perform the calculation  | 
            
                  None
             | 
          
Source code in counter/models.py
              
            get_total_sales(since=None)
¶
    Compute and return the total turnover of this counter since the given date.
By default, the date is the start of the current semester.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                since
             | 
            
                  datetime | date | None
             | 
            
               timestamp from which to perform the calculation  | 
            
                  None
             | 
          
Returns:
| Type | Description | 
|---|---|
                  CurrencyField
             | 
            
               Total revenue earned at this counter.  | 
          
Source code in counter/models.py
              
            customer_is_barman(customer)
¶
    Check if this counter is a bar and if the customer is currently logged in.
This is useful to compute special prices.
Source code in counter/models.py
              
            get_products_for(customer)
¶
    Get all allowed products for the provided customer on this counter Prices will be annotated
Source code in counter/models.py
              
            Product
¶
    
              Bases: Model
A product, with all its related information.
            is_owned_by(user)
¶
    Method to see if that object can be edited by the given user.
Source code in counter/models.py
              
            
            can_be_sold_to(user)
¶
    Check if whether the user given in parameter has the right to buy this product or not.
This must be not confused with the Customer.can_buy() method as the present method returns an information about the relation between a User and a Product, whereas the other tells something about a Customer (and not a user, they are not the same model).
Returns:
| Type | Description | 
|---|---|
                  bool
             | 
            
               True if the user can buy this product else False  | 
          
Warning
This performs a db query, thus you can quickly have a N+1 queries problem if you call it in a loop. Hopefully, you can avoid that if you prefetch the buying_groups :
Source code in counter/models.py
              
            ProductType
¶
    
              Bases: OrderedModel
A product type.
Useful only for categorizing.
            is_owned_by(user)
¶
    Method to see if that object can be edited by the given user.
            CounterSchema
¶
    
              Bases: ModelSchema
            CounterFilterSchema
¶
    
              Bases: FilterSchema
            SimplifiedCounterSchema
¶
    
              Bases: ModelSchema
            ProductTypeSchema
¶
    
              Bases: ModelSchema
            SimpleProductTypeSchema
¶
    
              Bases: ModelSchema
            ReorderProductTypeSchema
¶
    
              Bases: Schema
            SimpleProductSchema
¶
    
              Bases: ModelSchema
            ProductSchema
¶
    
              Bases: ModelSchema
            ProductFilterSchema
¶
    
              Bases: FilterSchema