Some basic support for gross SEO metadata formats with django-meta

This commit is contained in:
Danielle McLean 2017-10-24 21:57:07 +11:00
parent 1aed52b75f
commit 8ef64d6a87
Signed by untrusted user: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
8 changed files with 40 additions and 5 deletions

View file

@ -1,5 +1,6 @@
from django.db import models
from django.contrib.auth.models import AbstractUser
from meta.models import ModelMeta
def avatar_path(instance, name):
@ -18,10 +19,20 @@ class Site(models.Model):
ordering = ('name',)
class User(AbstractUser):
class User(ModelMeta, AbstractUser):
avatar = models.ImageField(upload_to=avatar_path)
note = models.TextField(blank=True)
@property
def avatar_url(self):
return self.avatar.url
_metadata = {
'image': 'avatar_url',
'description': 'note',
'og_type': 'profile',
}
class Profile(models.Model):
user = models.ForeignKey(