Changeset 49 in main


Ignore:
Timestamp:
07/01/10 12:48:27 (11 years ago)
Author:
pcosquer
Message:

fix a bug with formats choice field

Location:
trunk/openPLM/plmapp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/plmapp/customized_models/design.py

    r48 r49  
    77from openPLM.plmapp.models import Document 
    88from openPLM.plmapp.controllers import DocumentController 
    9 from openPLM.plmapp.utils import UNITS 
     9from openPLM.plmapp.utils import CFORMATS 
    1010 
    1111def register(cls): 
     
    2727        app_label = "plmapp" 
    2828 
    29     FORMATS = zip(UNITS.itervalues(), UNITS.itervalues())  
    3029    nb_pages = models.PositiveIntegerField("Number of pages", blank=True, null=True) 
    31     format = models.CharField(max_length=10, choices=FORMATS, default=lambda: "A4") 
     30    format = models.CharField(max_length=10, choices=CFORMATS, default=lambda: "A4") 
    3231 
    3332    @property 
  • trunk/openPLM/plmapp/customized_models/office.py

    r48 r49  
    77from openPLM.plmapp.models import Document 
    88from openPLM.plmapp.controllers import DocumentController 
    9 from openPLM.plmapp.utils import UNITS 
     9from openPLM.plmapp.utils import CFORMATS 
    1010 
    1111def register(cls): 
     
    2020        app_label = "plmapp" 
    2121 
    22     FORMATS = zip(UNITS.itervalues(), UNITS.itervalues())  
    2322    nb_pages = models.PositiveIntegerField("Number of pages", blank=True, null=True) 
    24     format = models.CharField(max_length=10, choices=FORMATS, default=lambda: "A4") 
     23    format = models.CharField(max_length=10, choices=CFORMATS, default=lambda: "A4") 
    2524 
    2625    @property 
  • trunk/openPLM/plmapp/utils.py

    r48 r49  
    142142    ("26.0", "37.0") : "A10", 
    143143} 
     144CFORMATS = [(x, x) for x in FORMATS.itervalues()] 
     145CFORMATS.sort() 
     146CFORMATS.append(("Other", "Other")) 
    144147def size_to_format(width_lg, height_lg): 
    145148    """ 
     
    152155    """ 
    153156    size = (normalize_length(width_lg), normalize_length(height_lg)) 
    154     return FORMATS.get(size, "Others") 
     157    return FORMATS.get(size, "Other") 
    155158 
    156159if __name__ == "__main__": 
Note: See TracChangeset for help on using the changeset viewer.