class Email(models.Model): email_addr = models.CharField(max_length=200) whoisology_status = models.BooleanField(default=False) module = models.CharField(max_length=200) # module used to find item derivativeKeyword = models.CharField(max_length=200) creation = models.DatetimeField() modification = models.DatetimeField()
class Scan(models.Model): ip_addr = models.CharField(max_length=200) port = models.CharField(max_length=200) protocol = models.CharField(max_length=200) banner = models.CharField(max_length=200) type_scan = models.CharField(max_length=100) # nmap , shodan creation = models.DatetimeField() modification = models.DatetimeField()
class Posts(models.Model): title = models.CharField(max_length=512, default=None, blank=False) content = models.TextField(default=None, blank=True) # slug = models.CharField(max_length=1000, default=None, blank=True) slug = models.SlugField(max_length=128, default=None, blank=True) # only to indicate whether its a Q or A # type = models.EnumField() # Rows having parent id are by default answers, rows not hving parent_id are Questions parent_id = models.ForeighKey( self, null=True, help_text= _("Rows having parent id are by default answers, rows not hving parent_id are Questions" )) date = models.DatetimeField(auto_now_add=True) user = models.ForeignKey(User) # This user_ip should go in User table # or maybe, what was the IP when this post was made user_ip = models.GenericIPAddressField() # we dont want a boolean field here, since, we may add 2,3,4 and other number depicting some other state status = models.IntegerField(default=None, null=True) # values 0-Deactivated, 1-Active def __unicode__(self): return self.title
class ProductCount(models.Model): """ How many different products exists. total = Product.objects.count() date = datetime.datetime.now() """ total = models.IntegerField() date = models.DatetimeField()
class Host(models.Model): fqdn = models.CharField(max_length=200) ip_address = models.CharField(max_length=39) inScope = models.IntegerField( default=2) # 0 if unknown, 1 if in scope, -1 if not censys = models.BooleanField(default=False) nmap = models.BooleanField(default=False) shodan = models.BooleanField(default=False) whois = models.BooleanField(default=False) nameserver = models.BooleanField(default=False) mailserver = models.BooleanField(default=False) other = models.BooleanField(default=False) module = models.CharField(max_length=200) # module used to find item derivativeKeyword = models.CharField(max_length=200) creation = models.DatetimeField() modification = models.DatetimeField()
class EventRecord(models.Model): """docstring for EventRecord""" class Meta: verbose_name = "操作紀錄" time = models.DatetimeField("時間", auto_now_add=True) name = models.CharField("姓名", max_length=10) event_record = models.TextField("紀錄")
class Sells(models.Model): store = models.ForeignKey(Store) game = models.ForeignKey(Game) store_id = models.CharField() retail_price = models.FloatField() current_price = models.FloatField( ) #not required - default to retail price timestamp = models.DatetimeField(auto_now=True) digital = models.Booleanfield(default=True)
class Votes(): post = models.ForeignKey(Posts) by_user = models.ForeignKey(User) vote = models.IntegerField() date = models.DatetimeField(auto_now_add=True) status = models.IntegerField(default=None, blank=True) # values 0-Deactivated, 1-Active def __unicode__(self): return unicode("%s: %s" % (self.post, self.vote))
class Event(models.Model): """docstring for Event""" class Meta: verbose_name = "事件" name = models.CharField("姓名", max_length=10) # ex: new, goto, goout, gonowhere, ... event_type = models.CharField("事件類型", max_length=10) create_time = models.DatetimeField("建立時間", auto_now_add=True) modify_time = models.DatetimeField("修改時間", auto_now=True) effective_date = models.DateField("生效日期") date = models.DateField("發文日期", blank=True) # ex: xxx-字第-{number}-號 number = models.CharField("發文字號", max_length=30, blank=True) # ex: {first}-{second}-{third} old_location = models.CharField("原單位", max_length=60, blank=True) old_title = models.CharField("原職稱", max_length=20, blank=True) new_location = models.CharField("新單位", max_length=60, blank=True) new_title = models.CharField("新職稱", max_length=20, blank=True)
class Book(models.Model): class Meta: db_table = 'book' id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) title = models.CharField(verbose_name='タイトル', max_length=20) price = models.IntegerField(verbose_name='価格', null=True) created_at = models.DatetimeField(default=timezone.now) def __str__(self): return self.title
class Entry(models.Model): text = models.TextField() timestamp = models.DatetimeField() # Instead of refer to User, or get_user_model, for Foreign keys you should use the AUTH_USER_MODEL setting instead # See: https://docs.djangoproject.com/en/2.0/topics/auth/customizing/#django.contrib.auth.get_user_model user = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.CASCADE, )
class PhotogramModel(models.Model): is_epic = models.BooleanField() shorter_comment = models.CharField(max_length=200) longer_comment = models.TextField() # Does it need a widget ? datetime_posted = models.DatetimeField(default=timezone.now) rating = models.FloatField( ) # https://www.geeksforgeeks.org/floatfield-django-models/ user_email = models.EmailField( blank=True, default='' ) # https://www.programcreek.com/python/example/51143/django.db.models.EmailField website = models.URLField( max_length=200 ) # https://www.geeksforgeeks.org/urlfield-django-models/
class Post(models.Model): author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) title = models.CharField(max_length=200) text = models.TextField() created_date = models.DateTimeField(default=timezone.now) published_date = models.DatetimeField(blank=True, null=True) def publish(self): self.published_date = timezone.now() self.save() def __str__(self): return self.title
class Evento(models.Model): nome = models.CharField(max_length=150, null=True, blank=False) eventoPrincipal = models.CharField(max_length=150, null=True, blank=False) sigla = models.CharField(max_length=5, null=True, blank=False) dataEHoraDeInicio = models.DatetimeField(blank=False, null=True) palavrasChaves = models.CharField(max_length=150, null=True, blank=False) logotipo = models.CharField(max_length=150, null=True, blank=False) realizador = models.ForeignKey(Pessoa, null=True, blank=False) cidade = models.CharField(max_length=100, null=True, blank=False) uf = models.CharField(max_length=2, null=True, blank=False) endereco = models.CharField(max_length=200, null=True, blank=False) cep = models.CharField(max_length=8, null=True, blank=False) def __str__(self): return '{} - {}'.format(self.nome, self.realizador.nome)
class hocsinh: maso = models.CharField(max_length=20) ten = models.CharField(max_length=50) ngaysinh = models.DatetimeField()
class Censys(models.Model): domainname = models.CharField(max_length=200) result = models.CharField(max_length=2000) creation = models.DatetimeField() modification = models.DatetimeField()
"" title = models.CharField(max_lenght=128) class StockRecord(models.Model): "" product = models.ForeignKey(Product) total_in_stock = models.IntegerField() class StockCount(models.Model): " How many stock do we have for each product. total = StockRecord.objects.get(product=product).total_in_stock date = datetime.datetime.now() " product = models.ForeignKey(Product) total = models.IntegerField() date = models.DatetimeField() class ProductCount(models.Model): """ How many different products exists. total = Product.objects.count() date = datetime.datetime.now() """ total = models.IntegerField() date = models.DatetimeField()
from django.db import models from django.contrib.auth.models import User # Create your models here. class Post(models.class (models.Model): user = models.models.ForeignKey(User, on_delete=models.CASCADE) body = models.TextField() created_at = models.DatetimeField() def __str__(self): return f'{self.user.get_username()} : {self.body}