verbose names

This commit is contained in:
Ludovic Stephan 2016-09-05 03:10:06 +02:00
parent de522a0035
commit b6655047ed
2 changed files with 11 additions and 9 deletions

View file

@ -216,16 +216,13 @@ class SpectacleReventeAdmin(admin.ModelAdmin):
def spectacle(self, obj): def spectacle(self, obj):
return obj.attribution.spectacle return obj.attribution.spectacle
def participant(self, obj): list_display = ("spectacle", "seller", "date", "soldTo")
return obj.attribution.participant
list_display = ("spectacle", "participant", "date", "soldTo")
raw_id_fields = ("attribution",) raw_id_fields = ("attribution",)
readonly_fields = ("shotgun", "expiration_time") readonly_fields = ("shotgun", "expiration_time")
search_fields = ("spectacle__title", search_fields = ("spectacle__title",
"participant__user__username", "seller__user__username",
"participant__user__firstname", "seller__user__firstname",
"participant__user__lastname",) "seller__user__lastname",)
admin.site.register(CategorieSpectacle) admin.site.register(CategorieSpectacle)

View file

@ -222,8 +222,10 @@ class SpectacleRevente(models.Model):
related_name="wanted", related_name="wanted",
blank=True) blank=True)
seller = models.ForeignKey(Participant, seller = models.ForeignKey(Participant,
related_name="original_shows") related_name="original_shows",
soldTo = models.ForeignKey(Participant, blank=True, null=True) verbose_name="Vendeur")
soldTo = models.ForeignKey(Participant, blank=True, null=True,
verbose_name="Vendue à")
def get_expiration_time(self): def get_expiration_time(self):
remaining_time = (self.attribution.spectacle.date - self.date) remaining_time = (self.attribution.spectacle.date - self.date)
@ -240,6 +242,9 @@ class SpectacleRevente(models.Model):
return "%s -- %s" % (self.seller, return "%s -- %s" % (self.seller,
self.attribution.spectacle.title) self.attribution.spectacle.title)
class Meta:
verbose_name = "Revente"
def send_notif(self): def send_notif(self):
# On récupère la liste des inscrits # On récupère la liste des inscrits
inscrits = self.attribution.spectacle.revente.select_related('user') inscrits = self.attribution.spectacle.revente.select_related('user')