Show
Ignore:
Timestamp:
04/30/08 13:35:20 (23 months ago)
Author:
JensDiemer
Message:

Experimental new Preferences!

  • New editor used the newforms models in the plugin class
  • Doesn't realy use the preferences (in search and find_and_replace) only display it
  • the system_settings doesn't used, too. Only for display the data.
  • Not ready in all cases
  • there can exist some print debug!
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/PyLucid/models.py

    r1538 r1544  
    542542 
    543543    def __unicode__(self): 
    544         return self.plugin_name.replace("_"," ") 
    545  
     544        txt = u"%s - %s" % (self.package_name, self.plugin_name) 
     545        return txt.replace(u"_",u" ") 
     546 
     547#______________________________________________________________________________ 
     548# Preference 
    546549 
    547550class Preference(models.Model): 
     551    """ 
     552    Stores preferences 
     553 
     554    Any pickleable Python object can be stored. 
     555 
     556    Use a small cache, so the pickle.loads() method would only be used on the 
     557    first access. 
     558 
     559    Note: 
     560        - This model has no Admin class. Because it makes no sense to edit 
     561            pickled data strings in the django admin panel ;) 
     562    """ 
     563    plugin = models.ForeignKey("Plugin", help_text="The associated plugin") 
     564    repr_string = models.TextField( 
     565        help_text="printable representation of the newform data dictionary" 
     566    ) 
     567 
     568    lastupdatetime = models.DateTimeField(auto_now=True, editable=False) 
     569    lastupdateby = models.ForeignKey( 
     570        User, null=True, blank=True, editable=False, 
     571    ) 
     572 
     573    #__________________________________________________________________________ 
     574 
     575    def __unicode__(self): 
     576        return u"Preference object for '%s'" % self.plugin 
     577 
     578    class Admin: 
     579        pass 
     580 
     581    class Meta: 
     582        # Use a new table 
     583        db_table = u'PyLucid_preference2' 
     584 
     585 
     586class PreferenceOld(models.Model): 
    548587    """ 
    549588    Stores preferences for the PyLucid system and all Plugins. 
     
    648687    lastupdateby = models.ForeignKey( 
    649688        User, null=True, blank=True, editable=False, 
    650         related_name="preferences_lastupdateby", 
    651689    ) 
    652690 
     
    669707        return "%s '%s'" % (self.plugin, self.name) 
    670708 
     709    class Meta: 
     710        # Use the old table 
     711        db_table = u'PyLucid_preference' 
     712 
     713 
     714#______________________________________________________________________________ 
    671715 
    672716