X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/5913c54d19b8f6775633176032161d49f9b2f1aa..2ad3a0ff948fcd754043b251e4767808babb25d2:/src/toolbar/models.py diff --git a/src/toolbar/models.py b/src/toolbar/models.py index a23e3463..a221e04b 100644 --- a/src/toolbar/models.py +++ b/src/toolbar/models.py @@ -1,10 +1,8 @@ -# -*- coding: utf-8 -*- -# # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class ButtonGroup(models.Model): @@ -16,7 +14,7 @@ class ButtonGroup(models.Model): ordering = ('position', 'name',) verbose_name, verbose_name_plural = _('button group'), _('button groups') - def __unicode__(self): + def __str__(self): return self.name def to_dict(self, with_buttons=False): @@ -34,7 +32,7 @@ class Button(models.Model): # behaviour params = models.TextField(default='[]') # TODO: should be a JSON field - scriptlet = models.ForeignKey('Scriptlet', null=True, blank=True) + scriptlet = models.ForeignKey('Scriptlet', models.SET_NULL, null=True, blank=True) link = models.CharField(max_length=256, blank=True, default='') # ui related stuff @@ -63,7 +61,7 @@ class Button(models.Model): 'scriptlet_id': self.scriptlet_id, } - def __unicode__(self): + def __str__(self): return self.label @@ -71,5 +69,5 @@ class Scriptlet(models.Model): name = models.CharField(max_length=64, primary_key=True) code = models.TextField() - def __unicode__(self): + def __str__(self): return _(u'javascript') + u':' + self.name