Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_super_entities(self):
"""
Gets the super entities this entity belongs to.
"""
return [self.team] if self.team is not None else []
def is_super_entity_relationship_active(self, super_entity):
"""
Make it an inactive relationship when the account is a captain
of a team.
"""
return not self.is_captain
class EntityPointer(models.Model):
"""
Describes a test model that points to an entity. Used for ensuring
that syncing entities doesn't perform any Entity deletes (causing models like
this to be cascade deleted)
"""
entity = models.ForeignKey(Entity)
class DummyModel(models.Model):
"""
Used to ensure that models that don't inherit from EntityModelMixin aren't syned.
"""
dummy_data = models.CharField(max_length=64)
objects = EntityModelManager()
# This is an auto-generated Django model module.
from django.db import models
class Album(models.Model):
albumid = models.IntegerField(primary_key=True, db_column=u'AlbumId')
title = models.TextField(db_column=u'Title') # Field name made lowercase. This field type is a guess.
artistid = models.IntegerField(db_column=u'ArtistId')
class Meta:
db_table = u'Album'
def __unicode__(self):
return "" % (self.title, self.artistid)
class Artist(models.Model):
artistid = models.IntegerField(primary_key=True, db_column=u'ArtistId')
name = models.TextField(db_column=u'Name', blank=True) # Field name made lowercase. This field type is a guess.
class Meta:
db_table = u'Artist'
class Customer(models.Model):
import string, re
import random
from django.contrib.auth.models import User
from django.db import models
from documents.models import Document
from vendors.models import Vendor
from specifications.models import Specification
from parts.models import Part
import datetime
from audit_log.models.fields import LastUserField
from audit_log.models.managers import AuditLog
class Report(models.Model):
"""
Stores characteristics of a single, self generated lot number.
"""
lot_number = models.CharField(max_length=128, null=True, blank=True, editable=False, unique=True)
mfg_lot_number = models.CharField(max_length=128, null=True, blank=True, help_text="The manufacturer's lot number (if available)")
vendor_lot_number = models.CharField(max_length=128, null=True, blank=True, help_text="The vendor's lot number (if available)")
heat_number = models.CharField(max_length=128, null=True, blank=True, help_text="The heat number (if available)")
vendor = models.ForeignKey(Vendor, help_text="Vendor or Manufacturer who supplied the material")
part_number = models.ForeignKey(Part, help_text="The TSA part number")
description = models.TextField()
origin_po = models.CharField(max_length=32, null=True, blank=True, help_text="The purchase order # material was purchased on")
origin_wo = models.CharField(max_length=32, null=True, blank=True, help_text="The work order # material was produced from")
approved = models.BooleanField(default=False)
receiving_date = models.DateField(default=datetime.datetime.today(), null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True, editable=True)
updated_at = models.DateTimeField(auto_now=True)
title = models.CharField(max_length=100)
slug = models.SlugField(unique=True)
thumbnail = models.URLField()
date = models.DateTimeField()
description = models.TextField(blank=True)
def __str__(self):
return self.title
class Event(models.Model):
title = models.CharField(max_length=254)
description = models.TextField(blank=True)
begin = models.DateTimeField(blank=True)
end = models.DateTimeField(blank=True)
youtube = models.URLField(blank=True)
manager = models.ForeignKey(get_user_model(), on_delete=models.PROTECT)
def __str__(self):
return self.title
current_revision = getattr(self, revision_field)
filters = {'pk': self.pk, revision_field: current_revision}
if not self.__class__.objects.filter(**filters).exists():
raise ValidationError(self.error_messages['modified'])
# Continue with all other cleaning.
return original_clean(self, *args, **kwargs)
return clean_with_revision
add_introspection_rules([], ["^varnish_bans_manager\.core\.models\.base\.RevisionField"])
###############################################################################
class JSONField(models.Field):
'''
Simple JSON field. See:
- https://github.com/bradjasper/django-jsonfield
'''
__metaclass__ = models.SubfieldBase
def to_python(self, value):
if isinstance(value, basestring):
try:
return json.loads(value)
except ValueError:
pass
return value
from datetime import datetime
from django.db import models
from django.contrib.auth import get_user_model
from goods.models import Goods
User = get_user_model()
# Create your models here.
class UserFav(models.Model):
"""
用户收藏
"""
user = models.ForeignKey(User, verbose_name="用户")
goods = models.ForeignKey(Goods, verbose_name="商品", help_text="商品ID")
add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间")
class Meta:
verbose_name = "用户收藏"
verbose_name_plural = verbose_name
# 联合唯一,由数据库完成
unique_together = ("user", "goods")
def __str__(self):
return self.user.username
verbose_name=_('Flags'),
help_text=_('Check flags for products in this categorization.'),
)
active = models.BooleanField(
_('Active'),
default=True,
help_text=_('Is this categorization publicly visible.'),
)
created_at = models.DateTimeField(
_('Created at'),
auto_now_add=True,
)
updated_at = models.DateTimeField(
_('Updated at'),
auto_now=True,
)
objects = CategorizationManager()
class Meta:
abstract = True
def __str__(self):
return self.safe_translation_getter('name', any_language=True)
def get_absolute_url(self, language=None):
if not language:
language = get_current_language() # pragma: no cover
operations = [
migrations.CreateModel(
name='SAMLAPP',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uuid', models.UUIDField(default=uuid.uuid4, unique=True)),
('is_del', models.BooleanField(default=False, verbose_name='是否删除')),
('is_active', models.BooleanField(default=True, verbose_name='是否可用')),
('updated', models.DateTimeField(auto_now=True, null=True, verbose_name='更新时间')),
('created', models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间')),
('entity_id', models.CharField(max_length=255, verbose_name='SP方entity_id')),
('acs', models.CharField(blank=True, max_length=255, verbose_name='SP方acs地址')),
('sls', models.CharField(blank=True, max_length=255, verbose_name='SP方sls地址')),
('cert', models.CharField(blank=True, max_length=2200, verbose_name='证书公钥')),
('xmldata', models.CharField(blank=True, max_length=5000, verbose_name='本地SP元数据')),
('app', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,\
related_name='saml_app', to='oneid_meta.APP')),
],
options={
'abstract': False,
},
),
migrations.RunPython(init_idp_config)
]
name = models.CharField(max_length=80)
class MailHandler(models.Model):
address = models.CharField(max_length=200)
actions = models.ManyToManyField(MailHandlerAction, blank=True, null=True)
users = models.ManyToManyField(User, blank=True, null=True)
groups = models.ManyToManyField(Group, blank=True, null=True)
def __unicode__(self):
return "'%s' mail handler" % self.address
class MailMessage(models.Model):
subject=models.TextField()
body=models.TextField()
recipient=models.CharField(max_length=200)
sender=models.CharField(max_length=200)
def adopt_contact_info(user):
p = user.userprofile
c = ContactInfo(address = p.address, address_line2 = p.address_line2, city = p.city, state = p.state, postal_code = p.postal_code, image = p.image )
c.save()
p.contact_info = c
p.save()
class DialList(models.Model):
name = models.CharField(max_length=30)
description = models.TextField(blank=True, null=True)
('name', models.CharField(max_length=255, unique=True, verbose_name='\u5206\u652f\u673a\u6784')),
('address', models.CharField(blank=True, max_length=255, null=True, verbose_name='\u529e\u516c\u5730\u5740')),
('telephone', models.CharField(blank=True, max_length=25, null=True, verbose_name='\u8054\u7cfb\u7535\u8bdd')),
('description', models.CharField(blank=True, max_length=255, null=True, verbose_name='\u5907\u6ce8')),
('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='appconf.AppOwner', verbose_name='\u8d1f\u8d23\u4eba')),
],
),
migrations.CreateModel(
name='Region',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, unique=True, verbose_name='\u884c\u653f\u533a\u57df')),
('address', models.CharField(blank=True, max_length=255, null=True, verbose_name='\u529e\u516c\u5730\u5740')),
('telephone', models.CharField(blank=True, max_length=25, null=True, verbose_name='\u8054\u7cfb\u7535\u8bdd')),
('description', models.CharField(blank=True, max_length=255, null=True, verbose_name='\u5907\u6ce8\u4fe1\u606f')),
('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='appconf.AppOwner', verbose_name='\u8d1f\u8d23\u4eba')),
],
),
migrations.CreateModel(
name='Resource',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sn', models.CharField(max_length=255, verbose_name='\u8d44\u6e90\u7f16\u7801')),
('name', models.CharField(max_length=255, verbose_name='\u8d44\u6e90\u540d\u79f0')),
('spec', models.CharField(max_length=255, verbose_name='\u8d44\u6e90\u89c4\u683c')),
('budget', models.CharField(blank=True, max_length=255, null=True, verbose_name='\u9884\u7b97\u91d1\u989d')),
('paid', models.CharField(blank=True, max_length=255, null=True, verbose_name='\u5408\u540c\u91d1\u989d')),
('contract', models.CharField(blank=True, max_length=255, null=True, verbose_name='\u5408\u540c\u7f16\u53f7')),
('contract_start', models.DateField(blank=True, max_length=255, null=True, verbose_name='\u5408\u540c\u5f00\u59cb')),
('contract_end', models.DateField(blank=True, null=True, verbose_name='\u5408\u540c\u7ed3\u675f')),
('supplier', models.CharField(blank=True, max_length=255, null=True, verbose_name='\u4f9b\u5e94\u5546\u540d')),
('service_phone', models.CharField(blank=True, max_length=25, null=True, verbose_name='\u670d\u52a1\u7535\u8bdd')),