replace __unicode__ with __str__ here and there, remove camp title from event boxes on schedule overview

This commit is contained in:
Thomas Steen Rasmussen 2017-01-31 23:39:49 +01:00
parent dcbf9b6992
commit 4cd344601a
4 changed files with 17 additions and 17 deletions

View file

@ -64,7 +64,7 @@ class Camp(CreatedUpdatedModel, UUIDModel):
if errors: if errors:
raise ValidationError(errors) raise ValidationError(errors)
def __unicode__(self): def __str__(self):
return "%s - %s" % (self.title, self.tagline) return "%s - %s" % (self.title, self.tagline)
@property @property

View file

@ -15,7 +15,7 @@ class EventType(CreatedUpdatedModel):
color = models.CharField(max_length=50) color = models.CharField(max_length=50)
light_text = models.BooleanField(default=False) light_text = models.BooleanField(default=False)
def __unicode__(self): def __str__(self):
return self.name return self.name
@ -31,7 +31,7 @@ class Event(CreatedUpdatedModel):
ordering = ['title'] ordering = ['title']
unique_together = (('camp', 'slug'), ('camp', 'title')) unique_together = (('camp', 'slug'), ('camp', 'title'))
def __unicode__(self): def __str__(self):
return '%s (%s)' % (self.title, self.camp.title) return '%s (%s)' % (self.title, self.camp.title)
def save(self, **kwargs): def save(self, **kwargs):
@ -54,7 +54,7 @@ class EventInstance(CreatedUpdatedModel):
class Meta: class Meta:
ordering = ['when'] ordering = ['when']
def __unicode__(self): def __str__(self):
return '%s (%s)' % (self.event, self.when) return '%s (%s)' % (self.event, self.when)
def __clean__(self): def __clean__(self):
@ -107,7 +107,7 @@ class Speaker(CreatedUpdatedModel):
ordering = ['name'] ordering = ['name']
unique_together = (('camp', 'name'), ('camp', 'slug')) unique_together = (('camp', 'name'), ('camp', 'slug'))
def __unicode__(self): def __str___(self):
return '%s (%s)' % (self.name, self.camp) return '%s (%s)' % (self.name, self.camp)
def save(self, **kwargs): def save(self, **kwargs):

View file

@ -13,7 +13,7 @@
style="background-color: {{ eventinstance.event.event_type.color }}; border: 0; color: {% if eveninstance.event.event_type.light_text %}white{% else %}black{% endif %};"> style="background-color: {{ eventinstance.event.event_type.color }}; border: 0; color: {% if eveninstance.event.event_type.light_text %}white{% else %}black{% endif %};">
<small>{{ eventinstance.when.lower|date:"H:i" }} - {{ eventinstance.when.upper|date:"H:i" }}</small> <small>{{ eventinstance.when.lower|date:"H:i" }} - {{ eventinstance.when.upper|date:"H:i" }}</small>
<br /> <br />
{{ event }} {{ event.title }}
<br /> <br />
{% if event.speakers.exists %}<i>by {{ event.speakers_list }}{% endif %}</i> {% if event.speakers.exists %}<i>by {{ event.speakers_list }}{% endif %}</i>
</a> </a>

View file

@ -35,7 +35,7 @@ class CustomOrder(CreatedUpdatedModel):
default=False, default=False,
) )
def __unicode__(self): def __str__(self):
return 'custom order id #%s' % self.pk return 'custom order id #%s' % self.pk
@property @property
@ -114,7 +114,7 @@ class Order(CreatedUpdatedModel):
objects = OrderQuerySet.as_manager() objects = OrderQuerySet.as_manager()
def __unicode__(self): def __str__(self):
return 'shop order id #%s' % self.pk return 'shop order id #%s' % self.pk
def get_number_of_items(self): def get_number_of_items(self):
@ -233,7 +233,7 @@ class ProductCategory(CreatedUpdatedModel, UUIDModel):
slug = models.SlugField() slug = models.SlugField()
public = models.BooleanField(default=True) public = models.BooleanField(default=True)
def __unicode__(self): def __str__(self):
return self.name return self.name
def save(self, **kwargs): def save(self, **kwargs):
@ -270,7 +270,7 @@ class Product(CreatedUpdatedModel, UUIDModel):
objects = ProductQuerySet.as_manager() objects = ProductQuerySet.as_manager()
def __unicode__(self): def __str__(self):
return '{} ({} DKK)'.format( return '{} ({} DKK)'.format(
self.name, self.name,
self.price, self.price,
@ -311,7 +311,7 @@ class EpayCallback(CreatedUpdatedModel, UUIDModel):
payload = JSONField() payload = JSONField()
md5valid = models.BooleanField(default=False) md5valid = models.BooleanField(default=False)
def __unicode__(self): def __str__(self):
return 'callback at %s (md5 valid: %s)' % (self.created, self.md5valid) return 'callback at %s (md5 valid: %s)' % (self.created, self.md5valid)
@ -349,7 +349,7 @@ class CreditNote(CreatedUpdatedModel):
) )
sent_to_customer = models.BooleanField(default=False) sent_to_customer = models.BooleanField(default=False)
def __unicode__(self): def __str__(self):
return 'creditnote#%s - %s DKK (sent to %s: %s)' % ( return 'creditnote#%s - %s DKK (sent to %s: %s)' % (
self.id, self.id,
self.amount, self.amount,
@ -372,7 +372,7 @@ class Invoice(CreatedUpdatedModel):
pdf = models.FileField(null=True, blank=True, upload_to='invoices/') pdf = models.FileField(null=True, blank=True, upload_to='invoices/')
sent_to_customer = models.BooleanField(default=False) sent_to_customer = models.BooleanField(default=False)
def __unicode__(self): def __str__(self):
if self.order: if self.order:
return 'invoice#%s - shop order %s - %s - total %s DKK (sent to %s: %s)' % ( return 'invoice#%s - shop order %s - %s - total %s DKK (sent to %s: %s)' % (
self.id, self.id,
@ -403,7 +403,7 @@ class CoinifyAPIInvoice(CreatedUpdatedModel):
invoicejson = JSONField() invoicejson = JSONField()
order = models.OneToOneField('shop.Order') order = models.OneToOneField('shop.Order')
def __unicode__(self): def __str__(self):
return "coinifyinvoice for order #%s" % self.order.id return "coinifyinvoice for order #%s" % self.order.id
@ -413,7 +413,7 @@ class CoinifyAPICallback(CreatedUpdatedModel):
order = models.ForeignKey('shop.Order') order = models.ForeignKey('shop.Order')
valid = models.BooleanField(default=False) valid = models.BooleanField(default=False)
def __unicode__(self): def __str__(self):
return 'order #%s callback at %s' % (self.order.id, self.created) return 'order #%s callback at %s' % (self.order.id, self.created)
@ -439,7 +439,7 @@ class Ticket(CreatedUpdatedModel, UUIDModel):
checked_in = models.BooleanField(default=False) checked_in = models.BooleanField(default=False)
def __unicode__(self): def __str__(self):
return 'Ticket {user} {product}'.format( return 'Ticket {user} {product}'.format(
user=self.order.user, user=self.order.user,
product=self.product product=self.product