models.py 328 B

12345678910
  1. from django.db import models
  2. from django.contrib.auth.models import User
  3. # 公钥表
  4. class PublicKey(models.Model):
  5. # 对应django自带的user
  6. user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='public_key')
  7. # 公钥
  8. public_key = models.CharField(max_length=1025, blank=False, unique=True)