Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class Meta:
ordering = ('rank',)
def edit(self):
return "Edit"
def __unicode__(self):
return self.name
class TimeSheet(models.Model):
student = models.ForeignKey(StudentWorker)
for_pay = models.BooleanField(default=False, help_text="Student is working over break and will be paid separately for this work.")
make_up = models.BooleanField(default=False, help_text="Student is making up a missed day.", verbose_name="makeup")
company = models.ForeignKey(WorkTeam) # Because a student's company can change but this shouldn't.
creation_date = models.DateTimeField(auto_now_add=True, validators=settings.DATE_VALIDATORS)
date = models.DateField(validators=settings.DATE_VALIDATORS)
time_in = models.TimeField()
time_lunch = models.TimeField()
time_lunch_return = models.TimeField()
time_out = models.TimeField()
hours = models.DecimalField(blank=True, max_digits=4, decimal_places=2, null=True)
school_pay_rate = models.DecimalField(blank=True, max_digits=5, decimal_places=2, null=True, help_text="Per hour pay rate the school is receiving from a company.")
student_pay_rate = models.DecimalField(blank=True, max_digits=5, decimal_places=2, null=True, help_text="Per hour pay rate the student is actually receiving.")
school_net = models.DecimalField(blank=True, max_digits=6, decimal_places=2, null=True)
student_net = models.DecimalField(blank=True, max_digits=6, decimal_places=2, null=True)
approved = models.BooleanField(default=False, verbose_name="approve")
student_accomplishment = models.TextField(blank=True)
performance = models.ForeignKey(TimeSheetPerformanceChoice, blank=True,null=True)
supervisor_comment = models.TextField(blank=True)
show_student_comments = models.BooleanField(default=True)
supervisor_key = models.CharField(max_length=20, blank=True)
import campaign.fields
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '__first__'),
]
operations = [
migrations.CreateModel(
name='BlacklistEntry',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('email', models.EmailField(max_length=75)),
('added', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
],
options={
'ordering': ('-added',),
'verbose_name': 'blacklist entry',
'verbose_name_plural': 'blacklist entries',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='MailTemplate',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=255, verbose_name='Name')),
('plain', models.TextField(verbose_name='Plaintext Body')),
('html', models.TextField(null=True, verbose_name='HTML Body', blank=True)),
('subject', models.CharField(max_length=255, verbose_name='Subject')),
class RunHistory(models.Model):
job = models.ForeignKey(Job, models.CASCADE, related_name='run_history')
operator = models.ForeignKey(User, models.SET_NULL, null=True, related_name='+')
date = models.DateTimeField(db_index=True)
status = models.CharField(choices=JOB_STATUS, max_length=1, default=JOB_STATUS[1][0])
configuration = models.ForeignKey(JobFile, models.CASCADE)
class Meta:
db_table = 'job_run_history'
class JobHistory(models.Model):
job = models.ForeignKey(Job, models.CASCADE, related_name='versions')
version = models.PositiveSmallIntegerField()
change_author = models.ForeignKey(User, models.SET_NULL, blank=True, null=True, related_name='+')
change_date = models.DateTimeField()
comment = models.CharField(max_length=255, default='', blank=True)
name = models.CharField(max_length=150)
global_role = models.CharField(max_length=1, choices=JOB_ROLES, default=JOB_ROLES[0][0])
class Meta:
db_table = 'jobhistory'
index_together = ['job', 'version']
ordering = ('-version',)
class FileSystem(models.Model):
job_version = models.ForeignKey(JobHistory, models.CASCADE, related_name='files')
name = models.CharField(max_length=1024)
file = models.ForeignKey(JobFile, models.CASCADE)
APPLICATION_TYPE_PSF_BOARD = "psf_board"
APPLICATION_TYPE_COMMUNITY_MEMBER = "outstanding_community_member"
APPLICATION_TYPE_CHOICES = (
(APPLICATION_TYPE_GENERAL, _("General Applicant")),
(APPLICATION_TYPE_STAFF, _("PyCon Staff/Volunteer")),
(APPLICATION_TYPE_SPEAKER, _("Speaker")),
(APPLICATION_TYPE_CORE_DEV, _("Python Core Developer")),
(APPLICATION_TYPE_PSF_BOARD, _("PSF Board Member")),
(APPLICATION_TYPE_COMMUNITY_MEMBER, _("Outstanding Community Member")),
)
class FinancialAidApplication(models.Model):
# The primary key ('id') is used as application number
timestamp = models.DateTimeField(auto_now_add=True, editable=False)
last_update = models.DateTimeField(auto_now=True, editable=False)
user = models.OneToOneField(settings.AUTH_USER_MODEL,
related_name='financial_aid', db_index=True)
pyladies_grant_requested = models.BooleanField(
default=False,
verbose_name=_("PyLadies grant"),
help_text=_("Would you like to be considered for a "
"PyLadies grant? (Women only.)"))
international = models.BooleanField(
default=False,
verbose_name=_("International"),
help_text=_("Will you be traveling internationally?"))
amount_requested = models.DecimalField(
verbose_name=_("Amount"),
help_text=_("Please enter the amount of assistance you "
operations = [
migrations.CreateModel(
name="LogEntry",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("object_id", models.PositiveIntegerField(db_index=True)),
("datetime", models.DateTimeField(auto_now_add=True, db_index=True)),
("action_type", models.CharField(max_length=255)),
("data", django.contrib.postgres.fields.jsonb.JSONField(null=True)),
(
"content_type",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="contenttypes.ContentType",
),
),
(
"user",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to=settings.AUTH_USER_MODEL,
STATUS_RUNNING = "running"
STATUS_FAILED = "failed"
STATUS_DONE = "done"
STATUS_SKIPPED = "skipped"
STATUSES = [
(STATUS_ENQUEUED, "Enqueued"),
(STATUS_DELAYED, "Delayed"),
(STATUS_RUNNING, "Running"),
(STATUS_FAILED, "Failed"),
(STATUS_DONE, "Done"),
(STATUS_SKIPPED, "Skipped"),
]
id = models.UUIDField(primary_key=True, editable=False)
status = models.CharField(max_length=8, choices=STATUSES, default=STATUS_ENQUEUED)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True, db_index=True)
message_data = models.BinaryField()
actor_name = models.CharField(max_length=300, null=True)
queue_name = models.CharField(max_length=100, null=True)
tasks = TaskManager()
class Meta:
ordering = ["-updated_at"]
@cached_property
def message(self):
return Message.decode(bytes(self.message_data))
def __str__(self):
), upload_to=_cover_uploader,
validators=(validators.FileSizeValidator(2),),
storage=storage.CDNStorage((300, 300))
)
#: The authors of the series.
authors = models.ManyToManyField(Author, blank=True)
#: The artists of the series.
artists = models.ManyToManyField(Artist, blank=True)
#: The categories of the series.
categories = models.ManyToManyField(Category, blank=True)
#: The status of the series.
completed = models.BooleanField(
default=False, help_text='Is the series completed?'
)
#: The date the series was created.
created = models.DateTimeField(auto_now_add=True, db_index=True)
#: The modification date of the series.
modified = models.DateTimeField(auto_now=True)
#: The chapter name format of the series.
format = models.CharField(
max_length=100, default='Vol. {volume}, Ch. {number}: {title}',
help_text='The format used to render the chapter names.',
verbose_name='chapter name format'
)
#: The aliases of the series.
aliases = GenericRelation(
to=Alias, blank=True, related_query_name='alias'
)
def get_absolute_url(self) -> str:
"""
Get the absolute URL of the object.
start = models.TimeField(u'Início')
end = models.TimeField(u'Fim')
def __unicode__(self):
return smart_unicode(self.lecture)
class Event(models.Model):
class Meta:
verbose_name = u'Evento'
verbose_name_plural = u'Eventos'
description = models.CharField(u'Descrição', max_length=100)
full_description = models.TextField(u'Descrição Completa')
date = models.DateTimeField(u'Data')
location = models.ForeignKey(
'event_generator.Location', verbose_name=u'Local',
)
image = models.ImageField(upload_to='uploads/events')
slug = models.SlugField()
def __unicode__(self):
return self.description
def get_absolute_url(self):
return reverse('event', kwargs={'slug': self.slug})
options={
'db_table': 'sport_day',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='SportSession',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('time', models.DurationField(null=True, blank=True)),
('distance', models.FloatField(null=True, blank=True)),
('name', models.CharField(max_length=255, null=True, blank=True)),
('comment', models.TextField(null=True, blank=True)),
('type', models.CharField(default=b'training', max_length=12, choices=[(b'training', b'Entrainement'), (b'race', b'Course'), (b'rest', b'Repos')])),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'sport_session',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='SportWeek',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('year', models.IntegerField(default=2013)),
('week', models.IntegerField(default=0)),
('published', models.BooleanField(default=False)),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('comment', models.TextField(null=True, blank=True)),
class Credential(models.Model):
CREDENTIAL_TYPE_PASSWORD = "password"
CREDENTIAL_TYPE_PRIVATE_KEY = "privateKey"
CREDENTIAL_TYPE_CHOICES = (
(CREDENTIAL_TYPE_PASSWORD, "password"),
(CREDENTIAL_TYPE_PRIVATE_KEY, "privateKey")
)
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
name = models.SlugField(max_length=128, allow_unicode=True, unique=True, verbose_name=_('Name'))
username = models.CharField(max_length=256, default='root')
password = common_models.EncryptCharField(max_length=4096, blank=True, null=True)
private_key = common_models.EncryptCharField(max_length=8192, blank=True, null=True)
type = models.CharField(max_length=128, choices=CREDENTIAL_TYPE_CHOICES, default=CREDENTIAL_TYPE_PASSWORD)
date_created = models.DateTimeField(auto_now_add=True)
@property
def private_key_obj(self):
return ssh_key_string_to_obj(self.private_key, self.password)
@property
def private_key_path(self):
if not self.type == 'privateKey':
return None
tmp_dir = os.path.join(settings.BASE_DIR, 'data', 'tmp')
if not os.path.isdir(tmp_dir):
os.makedirs(tmp_dir)
key_name = '.' + md5(self.private_key.encode('utf-8')).hexdigest()
key_path = os.path.join(tmp_dir, key_name)
if not os.path.exists(key_path):
self.private_key_obj.write_private_key_file(key_path)