This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.utils.translation import ugettext_lazy as _ | |
from django_countries.fields import CountryField # https://pypi.org/project/django-countries/ | |
class shipping_address(models.Model): | |
# addressees full legal name | |
full_name = models.CharField(max_length=70, blank=True, verbose_name=_('Full name')) | |
organisation = models.CharField(max_length=50, blank=True, verbose_name=_('Organisation/Company name')) | |
street_address_1 = models.CharField(max_length=50, blank=True, verbose_name=_('Street address line 1')) | |
street_address_2 = models.CharField(max_length=50, blank=True, verbosename=_('Street address line 2')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class AlbumAdmin(ImportExportModelAdmin, admin.ModelAdmin): | |
list_display=('name', 'release_date', 'artist', 'get_musician_instrument') | |
list_filter=('name') | |
def get_musician_instrument(self,obj): | |
Return obj.artist.instrument | |
get_musician_instrument.admin_order_field='artist' # allowscolumnordersorting | |
get_musician_instrument.short_description='Instrument' # overwritecolumnname |