Changeset - adf2229720fc
[Not reviewed]
0 9 0
Ben Sturmfels (bsturmfels) - 2 years ago 2022-01-10 22:13:46
ben@sturm.com.au
Rename __unicode__ methods to __str__ following Django upgrade.
9 files changed with 18 insertions and 14 deletions:
0 comments (0 inline, 0 general)
www/conservancy/apps/blog/models.py
Show inline comments
...
 
@@ -13,13 +13,13 @@ class EntryTag(models.Model):
 
    label = models.CharField(max_length=100)
 
    slug = models.SlugField()
 

	
 
    class Meta(object):
 
        db_table = 'techblog_entrytag' # legacy
 

	
 
    def __unicode__(self):
 
    def __str__(self):
 
        return self.label
 

	
 
    def get_absolute_url(self):
 
        return u"/blog/?tag=%s" % self.slug
 

	
 
class Entry(models.Model, bsoup.SoupModelMixin):
...
 
@@ -41,13 +41,13 @@ class Entry(models.Model, bsoup.SoupModelMixin):
 
        verbose_name_plural = 'entries'
 
        ordering = ('-pub_date',)
 
        get_latest_by = 'pub_date'
 

	
 
    SOUP_ATTRS = ['body']
 

	
 
    def __unicode__(self):
 
    def __str__(self):
 
        return self.headline
 

	
 
    def get_absolute_url(self):
 
        return (u"/blog/%s/%s/"
 
                % (self.pub_date.strftime("%Y/%b/%d").lower(),
 
                   self.slug))
www/conservancy/apps/events/models.py
Show inline comments
...
 
@@ -11,13 +11,13 @@ class EventTag(models.Model):
 
    """
 

	
 
    label = models.CharField(max_length=100)
 

	
 
    date_created = models.DateField(auto_now_add=True)
 

	
 
    def __unicode__(self):
 
    def __str__(self):
 
        return self.label
 

	
 
class PastEventManager(models.Manager):
 
    """Returns all past events"""
 

	
 
    def get_queryset(self):
...
 
@@ -47,13 +47,13 @@ class Event(models.Model):
 
    date_created = models.DateTimeField(auto_now_add=True)
 
    date_last_modified = models.DateTimeField(auto_now=True)
 

	
 
    class Meta(object):
 
        ordering = ("-date",)
 

	
 
    def __unicode__(self):
 
    def __str__(self):
 
        return u"%s (%s)" % (self.title, self.date)
 

	
 
    def get_absolute_url(self):
 
        return u"/events/%s/%s/" % (self.date.strftime("%Y"), self.slug)
 

	
 
    def day_after(self):
...
 
@@ -87,9 +87,9 @@ class EventMedia(models.Model):
 
    date_created = models.DateTimeField(auto_now_add=True)
 
    date_last_modified = models.DateTimeField(auto_now=True)
 

	
 
    class Meta(object):
 
        verbose_name_plural = 'event media'
 

	
 
    def __unicode__(self):
 
    def __str__(self):
 
        return u"%s media: %s" % (self.event, self.format)
 

	
www/conservancy/apps/fundgoal/models.py
Show inline comments
...
 
@@ -12,13 +12,13 @@ class FundraisingGoal(models.Model):
 
    fundraiser_goal_amount = models.DecimalField(max_digits=10, decimal_places=2)
 
    fundraiser_so_far_amount = models.DecimalField(max_digits=10, decimal_places=2)
 
    fundraiser_donation_count = models.IntegerField()
 
    fundraiser_donation_count_disclose_threshold = models.IntegerField()
 
    fundraiser_endtime = models.DateTimeField(null=True)
 

	
 
    def __unicode__(self):
 
    def __str__(self):
 
        return self.fundraiser_code_name
 

	
 
    def percentage_there(self):
 
        return (old_div(self.fundraiser_so_far_amount, self.fundraiser_goal_amount) ) * 100
 
    
 
    class Meta(object):
...
 
@@ -41,8 +41,8 @@ class GoalProvider(models.Model):
 
    fundraising_goal = models.ForeignKey(
 
        'FundraisingGoal',
 
        on_delete=models.CASCADE,
 
    )
 
    provider_name = models.CharField(max_length=512)
 

	
 
    def __unicode__(self):
 
    def __str__(self):
 
        return self.provider_name
www/conservancy/apps/news/models.py
Show inline comments
...
 
@@ -27,13 +27,13 @@ class PressRelease(models.Model, bsoup.SoupModelMixin):
 
    class Meta(object):
 
        ordering = ("-pub_date",)
 
        get_latest_by = "pub_date"
 

	
 
    SOUP_ATTRS = ['summary', 'body']
 

	
 
    def __unicode__(self):
 
    def __str__(self):
 
        return self.headline
 

	
 
    def get_absolute_url(self):
 
        return u"/news/%s/%s/" % (self.pub_date.strftime("%Y/%b/%d").lower(),
 
                                  self.slug)
 

	
...
 
@@ -73,13 +73,13 @@ class ExternalArticleTag(models.Model):
 
    """A way to tag external articles"""
 

	
 
    label = models.CharField(max_length=100)
 

	
 
    date_created = models.DateField(auto_now_add=True)
 

	
 
    def __unicode__(self):
 
    def __str__(self):
 
        return self.label
 

	
 
class PublicExternalArticleManager(models.Manager):
 
    def get_queryset(self):
 
        return super(PublicExternalArticleManager, self).get_queryset().filter(visible=True)
 

	
...
 
@@ -106,12 +106,12 @@ class ExternalArticle(models.Model):
 
    date_created = models.DateField(auto_now_add=True)
 

	
 
    class Meta(object):
 
        ordering = ("-date_created",)
 
        get_latest_by = "date_created"
 

	
 
    def __unicode__(self):
 
    def __str__(self):
 
        return u"%s (%s)" % (self.title, self.publication)
 

	
 
    objects = models.Manager()
 
    public = PublicExternalArticleManager()
 

	
www/conservancy/apps/staff/models.py
Show inline comments
...
 
@@ -20,11 +20,11 @@ class Person(models.Model):
 
    date_created = models.DateTimeField(auto_now_add=True)
 
    date_last_modified = models.DateTimeField(auto_now=True)
 

	
 
    class Meta(object):
 
        verbose_name_plural = 'people'
 

	
 
    def __unicode__(self):
 
    def __str__(self):
 
        return self.username
 

	
 
    def biography_url(self):
 
        return u"/about/#%s" % self.username
www/conservancy/apps/supporters/models.py
Show inline comments
...
 
@@ -7,11 +7,11 @@ class Supporter(models.Model):
 
    display_name = models.CharField(max_length=200, blank=False)
 
    display_until_date = models.DateTimeField("date until which this supporter name is displayed")
 
    ledger_entity_id = models.CharField(max_length=200, blank=False)
 

	
 
    def test(self):
 
        return "TESTING"
 
    def __unicode__(self):
 
    def __str__(self):
 
        return self.display_name
 

	
 
    class Meta(object):
 
        ordering = ('ledger_entity_id',)
www/conservancy/apps/worldmap/models.py
Show inline comments
...
 
@@ -11,13 +11,13 @@ class EarthLocation(models.Model):
 
    date_created = models.DateTimeField(auto_now_add=True)
 
    date_last_modified = models.DateTimeField(auto_now=True)
 

	
 
    class Meta(object):
 
        unique_together = (("latitude", "longitude"),)
 

	
 
    def __unicode__(self):
 
    def __str__(self):
 
        return self.label
 

	
 
    def google_maps_link(self):
 
        return ("http://maps.google.com/maps?ll=%s,%s&z=15"
 
                % (self.latitude, self.longitude))
 

	
www/conservancy/settings.py
Show inline comments
...
 
@@ -23,13 +23,13 @@ from djangocommonsettings import *
 

	
 
SITE_ID = 2
 
ROOT_URLCONF = 'conservancy.urls'
 

	
 
FORCE_CANONICAL_HOSTNAME = False if DEBUG else 'sfconservancy.org'
 

	
 
ALLOWED_HOSTS = [ 'www.sfconservancy.org', 'aspen.sfconservancy.org', 'sfconservancy.org',  u'104.130.70.210' ]
 
ALLOWED_HOSTS = ['www.sfconservancy.org', 'aspen.sfconservancy.org', 'sfconservancy.org',  u'104.130.70.210', '*']
 
if DEBUG:
 
    ALLOWED_HOSTS.append('localhost')
 

	
 
REDIRECT_TABLE = {
 
    'www.sf-conservancy.org': 'sfconservancy.org',
 
}
www/conservancy/urls.py
Show inline comments
...
 
@@ -39,12 +39,16 @@ urlpatterns = [
 
    url(r'^feeds/?$', feeds.view),
 
    url(r'^news/', include('conservancy.apps.news.urls')),
 
    url(r'^blog/', include('conservancy.apps.blog.urls')),
 
    # formerly static templated things... (dirs with templates)
 
    url(r'^error/(40[134]|500)(?:/index\.html|/|)$', static_views.handler),
 
    url(r'^error', static_views.index),
 
    url(r'^admin/css/', static_views.index),
 
    url(r'^css', static_views.index),
 
    url(r'^js', static_views.index),
 
    url(r'^img', static_views.index),
 
    url(r'^about', static_views.index),
 
    url(r'^activities', static_views.index),
 
    url(r'^donate', static_views.index),
 
    url(r'^copyleft-compliance', static_views.index,
 
                           {'fundraiser_sought' : 'vmware-match-0'}),
 
    url(r'^learn', static_views.index),
0 comments (0 inline, 0 general)