Last active
November 11, 2021 05:47
-
-
Save RobbiNespu/f8b35942d6941d847f20a2a8223df26e to your computer and use it in GitHub Desktop.
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.contrib import admin | |
from .models import Post | |
# Register your models here. | |
admin.site.register(Post) | |
class PostAdmin(admin.ModelAdmin): | |
radio_fields = {"source": admin.VERTICAL} | |
# radio_fields = {"IndiewebSource": admin.VERTICAL} |
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 | |
# Create your models here. | |
class IndiewebKind(models.Model): | |
kind = models.CharField(max_length=14) | |
date_added = models.DateTimeField(auto_now_add=True) | |
class Meta: | |
ordering = ['-date_added'] | |
def __str__(self): | |
return self.kind | |
class IndiewebSource(models.Model): | |
source = models.CharField(max_length=14, default='website') | |
date_added = models.DateTimeField(auto_now_add=True) | |
class Meta: | |
ordering = ['-date_added'] | |
def __str__(self): | |
return self.source | |
class Post(models.Model): | |
title = models.CharField(max_length=255) | |
slug = models.SlugField() | |
kind = models.ForeignKey(IndiewebKind, on_delete=models.CASCADE) | |
source = models.ForeignKey(IndiewebSource, on_delete=models.CASCADE, null=True) | |
intro = models.TextField(max_length=150) | |
body = models.TextField() | |
date_added = models.DateTimeField(auto_now_add=True) | |
class Meta: | |
ordering = ['-date_added'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
simple patch: