> -----Original Message----- > From: Damian, Alexandru [mailto:[email protected]] > Sent: Monday, January 20, 2014 3:28 AM > To: Lerner, Dave > Cc: Barros Pena, Belen ([email protected]); [email protected] > Subject: Re: Changing code constants to reflect package type display strings > and > ordering > > Hi Dave, > > > Yep, the constants are arbitrary, and they can be changed. > > You can get the constant text directly displayed in the html template using > the > object.get_FIELDNAME_display function. > > > I would suggest any constant here be in all lowercase, and if we need it > displayed > capitalized, use the "title" filter in the Django template. eg. > {{dependency.get_dep_type_display|title}} > > > Does this sound ok to you ?
Sounds perfect, thanks. Dave > > Alex > > > > On Sat, Jan 18, 2014 at 6:27 PM, Lerner, Dave <[email protected]> > wrote: > > > Hi Alex, Belen > > We have view specs regarding ordering and display values for > package_dependencies. > > The non RDEPENDS releationship types are to be sorted in this order and > displayed > with these strings: > > 1. Recommends > 2. Suggests > 3. Provides > 4. Replaces > 5. Conflicts > > These two constraints do not map directly to what I'm guessing is an > arbitrary set > of constants in Package_Dependency.DEPENDS_TYPE in models.py. I couldn't find > references to this list outside of the package detail source file. > > Can we change... > class Package_Dependency(models.Model): > TYPE_RDEPENDS = 0 > TYPE_RPROVIDES = 1 > TYPE_RRECOMMENDS = 2 > TYPE_RSUGGESTS = 3 > TYPE_RREPLACES = 4 > TYPE_RCONFLICTS = 5 > TYPE_TRDEPENDS = 6 > TYPE_TRECOMMENDS = 7 > DEPENDS_TYPE = ( > (TYPE_RDEPENDS, "rdepends"), > (TYPE_RPROVIDES, "rprovides"), > (TYPE_RRECOMMENDS, "rrecommends"), > (TYPE_RSUGGESTS, "rsuggests"), > (TYPE_RREPLACES, "rreplaces"), > (TYPE_RCONFLICTS, "rconflicts"), > (TYPE_TRDEPENDS, "trdepends"), > (TYPE_TRECOMMENDS, "trecommends"), > ) > to... > TYPE_RDEPENDS = 1 > TYPE_TRDEPENDS = 2 > TYPE_RRECOMMENDS = 3 > TYPE_TRECOMMENDS = 4 > TYPE_RSUGGESTS = 5 > TYPE_RPROVIDES = 6 > TYPE_RREPLACES = 7 > TYPE_RCONFLICTS = 8 > DEPENDS_TYPE = ( > (TYPE_RDEPENDS, "Depends"), > (TYPE_TRDEPENDS, "Depends"), > (TYPE_RRECOMMENDS, "Recommends"), > (TYPE_TRECOMMENDS, "Recommends"), > (TYPE_RPROVIDES, "Provids"), > (TYPE_RSUGGESTS, "Suggests"), > (TYPE_RREPLACES, "Replaces"), > (TYPE_RCONFLICTS, "Conflicts"), > ) > > With this change, the database values map to correct display order and > the list > maps to display strings. I haven't looked at every other spec, though to see > if any > other ordering of relationship types is required. > > Ok to include this change? > Dave > > > > > > -- > > Alex Damian > Yocto Project > > SSG / OTC _______________________________________________ toaster mailing list [email protected] https://lists.yoctoproject.org/listinfo/toaster
