Wednesday, May 30, 2018

Django Model

Hello all.

I'm beginer. Sorry. Can anyone help me with this model. It did't work(TypeError: expected string or bytes-like object

):

import whois

class Domains(models.Model):
domainname = models.CharField(max_length=200, blank=True)
domainuser = models.ForeignKey(User, on_delete=models.CASCADE)
details = whois.whois(domainname)
w = str(details.expiration_date)
domainwhois = models.DateField(default=w)

def __str__(self):
return self.domainname

Domains.save()

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/53525a55-0d68-4a8c-9031-5d7c3baa7064%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment