Last active
June 5, 2019 02:53
-
-
Save ryu22e/42f71eed4a57b0d936b0d970f1927c0e to your computer and use it in GitHub Desktop.
Djangoの脆弱性CVE-2019–12308・CVE-2019–11358について解説(1)
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 .forms import PostAdminForm | |
from .models import Post | |
class PostAdmin(admin.ModelAdmin): | |
form = PostAdminForm | |
admin.site.register(Post, PostAdmin) |
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 import forms | |
from .models import Post | |
class PostAdminForm(forms.ModelForm): | |
content = forms.CharField(widget=forms.Textarea) | |
class Meta: | |
model = Post | |
fields = '__all__' |
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 | |
class Post(models.Model): | |
title = models.CharField(max_length=100, verbose_name="タイトル") | |
content = models.CharField(max_length=1000, verbose_name="内容") | |
url = models.URLField(verbose_name="URL") | |
def __str__(self): | |
return self.title | |
class Meta: | |
verbose_name = "投稿" | |
verbose_name_plural = "投稿" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment