Set user foreign key to be blank allowing null values

This commit is contained in:
PCoder 2019-07-01 23:11:49 +05:30
parent 32de20aaba
commit ddaa320628

View file

@ -1,11 +1,11 @@
import json import json
import logging import logging
import os import os
import pytz from datetime import datetime
import pytz
from Crypto.PublicKey import RSA from Crypto.PublicKey import RSA
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from datetime import datetime
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
from django.utils.functional import cached_property from django.utils.functional import cached_property
@ -187,7 +187,7 @@ class HostingOrder(AssignPermissionsMixin, models.Model):
class UserHostingKey(models.Model): class UserHostingKey(models.Model):
user = models.ForeignKey(CustomUser) user = models.ForeignKey(CustomUser, blank=True, null=True)
public_key = models.TextField() public_key = models.TextField()
private_key = models.FileField(upload_to='private_keys', blank=True) private_key = models.FileField(upload_to='private_keys', blank=True)
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)