Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class Status(models.Model):
StatusID = models.IntegerField(primary_key=True)
StatusName = models.CharField(max_length=30)
def __unicode__(self):
return self.StatusName
class Meta:
db_table = 'Status'
class Category(models.Model):
CategoryID = models.AutoField(primary_key=True)
CategoryName = models.CharField(max_length=30)
def __unicode__(self):
return self.CategoryName
class Meta:
db_table = 'Categories'
class Tool(models.Model):
ToolID = models.AutoField(primary_key=True)
ToolName = models.CharField(max_length=30)
Category = models.ForeignKey(Category, db_column="CategoryID", related_name="Tools")
ToolDescription = models.CharField(max_length=100, null=True, blank=True)
User = models.ForeignKey(User, editable=False)
PublicInd = models.BooleanField(default=False)
from django.contrib.auth.models import User
from django.db import models
from apps.thirdparty.userroles import roles
import pdb
class UserRole(models.Model):
user = models.ForeignKey(User, related_name='role')
name = models.CharField(max_length=100, choices=roles.choices)
child = models.CharField(max_length=100, blank=True)
_valid_roles = roles
@property
def profile(self):
if not self.child:
return None
return getattr(self, self.child)
def __eq__(self, other):
return self.name == other
# return self.name == other.name
def __getattr__(self, name):
if name.startswith('is_'):
role = getattr(self._valid_roles, name[3:], None)
class Migration(migrations.Migration):
dependencies = [
('workflow', '0023_auto_20180425_0136'),
]
operations = [
migrations.AddField(
model_name='dashboard',
name='dashboard_uuid',
field=models.UUIDField(blank=True, null=True, default=None, verbose_name='Dashboard UUID'),
),
migrations.AddField(
model_name='dashboard',
name='public_url_token',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='dashboard',
name='public',
field=models.CharField(blank=True, choices=[('org', 'Organization'), ('url', 'URL'), ('all', 'All')], max_length=5, null=True),
),
item_458_choices = [(u'produces', u'produces')]
item_458 = models.CharField(max_length=8, choices=item_458_choices, null=True)
item_459_choices = [(u'produces', u'produces')]
item_459 = models.CharField(max_length=8, choices=item_459_choices, null=True)
item_460_choices = [(u'produces', u'produces')]
item_460 = models.CharField(max_length=8, choices=item_460_choices, null=True)
item_461_choices = [(u'produces', u'produces')]
item_461 = models.CharField(max_length=8, choices=item_461_choices, null=True)
item_462_choices = [(u'produces', u'produces')]
item_462 = models.CharField(max_length=8, choices=item_462_choices, null=True)
item_463_choices = [(u'produces', u'produces')]
item_463 = models.CharField(max_length=8, choices=item_463_choices, null=True)
item_464_choices = [(u'produces', u'produces')]
item_464 = models.CharField(max_length=8, choices=item_464_choices, null=True)
item_465_choices = [(u'produces', u'produces')]
item_465 = models.CharField(max_length=8, choices=item_465_choices, null=True)
item_466_choices = [(u'produces', u'produces')]
item_466 = models.CharField(max_length=8, choices=item_466_choices, null=True)
item_467_choices = [(u'produces', u'produces')]
item_467 = models.CharField(max_length=8, choices=item_467_choices, null=True)
item_468_choices = [(u'produces', u'produces')]
item_468 = models.CharField(max_length=8, choices=item_468_choices, null=True)
item_469_choices = [(u'produces', u'produces')]
item_469 = models.CharField(max_length=8, choices=item_469_choices, null=True)
item_470_choices = [(u'produces', u'produces')]
item_470 = models.CharField(max_length=8, choices=item_470_choices, null=True)
item_471_choices = [(u'produces', u'produces')]
item_471 = models.CharField(max_length=8, choices=item_471_choices, null=True)
item_472_choices = [(u'produces', u'produces')]
item_472 = models.CharField(max_length=8, choices=item_472_choices, null=True)
item_473_choices = [(u'produces', u'produces')]
item_473 = models.CharField(max_length=8, choices=item_473_choices, null=True)
sublayers = models.ManyToManyField('self', blank=True, null=True, help_text="Select the PARENT layer (which should be checkbox or radio type). Be sure to also check is_sublayer.")
themes = models.ManyToManyField("Theme", null=True)
is_sublayer = models.BooleanField(default=False)
legend = models.CharField(max_length=255, blank=True, null=True, help_text="URL to legend image")
legend_title = models.CharField(max_length=255, blank=True, null=True)
legend_subtitle = models.CharField(max_length=255, blank=True, null=True)
utfurl = models.CharField(max_length=255, blank=True, null=True)
default_on = models.BooleanField(default=False, help_text="Should layer appear initially on load?")
#tooltip
description = models.TextField(blank=True, null=True)
#data description (updated fact sheet) (now the Learn pages)
data_overview = models.TextField(blank=True, null=True)
data_status = models.CharField(max_length=255, blank=True, null=True)
data_source = models.CharField(max_length=512, blank=True, null=True)
data_notes = models.TextField(blank=True, null=True)
#data catalog links
bookmark = models.CharField(max_length=755, blank=True, null=True)
map_tiles = models.CharField(max_length=255, blank=True, null=True)
kml = models.CharField(max_length=255, blank=True, null=True)
data_download = models.CharField(max_length=255, blank=True, null=True)
learn_more = models.CharField(max_length=255, blank=True, null=True)
metadata = models.CharField(max_length=255, blank=True, null=True)
fact_sheet = models.CharField(max_length=255, blank=True, null=True)
source = models.CharField(max_length=512, blank=True, null=True)
thumbnail = models.URLField(max_length=255, blank=True, null=True)
#geojson javascript attribution
EVENT_CHOICES = (
('click', 'click'),
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('activitydb', '0023_tolasites_tola_report_url'),
]
operations = [
migrations.CreateModel(
name='LoggedUser',
fields=[
('username', models.CharField(max_length=30, primary_key=True, serialize=False)),
('country', models.CharField(max_length=100)),
('email', models.CharField(default='user@mercycorps.com', max_length=100)),
],
def get_absolute_url(self):
"""Returns the url to access a detail record for this book."""
return reverse('website:booklets', args=[str(self.slug)])
def __str__(self):
return self.title
class UserUploadedBooklet(models.Model):
"""
This model is for the form that user filled and uploaded website.
This is temporary form and Admin should validate and upload it in Booklet model.
"""
title = models.CharField(null=False, blank=False, verbose_name="عنوان", max_length=120)
field = models.CharField(null=False, blank=False, verbose_name="رشته", max_length=120)
topic = models.CharField(null=False, blank=False, verbose_name="درس", max_length=120)
writer = models.CharField(null=False, blank=False, verbose_name="نویسنده", max_length=120)
# Admin should remove this after manipulating.
booklet_file = models.FileField(upload_to="website/tmp_booklet_content", null=True, blank=True)
BOOKLET_STATUS = (
('seen', "مشاهده شد"),
('pending', "در حال انجام"),
('finished', "انجام شد"),
('canceled', "لغو شد"),
)
status = models.CharField(
max_length=20,
_('content template'), max_length=250,
default='zinnia/_entry_detail.html',
choices=[('zinnia/_entry_detail.html', _('Default template'))] +
ENTRY_CONTENT_TEMPLATES,
help_text=_("Template used to display the entry's content."))
class Meta:
abstract = True
class DetailTemplateEntry(models.Model):
"""
Abstract model class to display entries with a
custom template if needed on the detail page.
"""
detail_template = models.CharField(
_('detail template'), max_length=250,
default='entry_detail.html',
choices=[('entry_detail.html', _('Default template'))] +
ENTRY_DETAIL_TEMPLATES,
help_text=_("Template used to display the entry's detail page."))
class Meta:
abstract = True
class AbstractEntry(
CoreEntry,
ContentEntry,
DiscussionsEntry,
RelatedEntry,
LeadEntry,
from __future__ import unicode_literals
from django.db import models
class Device(models.Model):
hostname = models.CharField(max_length=30, verbose_name="Hostname")
ip_address = models.CharField(max_length=16, verbose_name="IP address")
vendor = models.CharField(max_length=30, verbose_name="Vendor")
operations = [
migrations.AlterField(
model_name='farm',
name='ip',
field=models.GenericIPAddressField(null=True, editable=False, help_text='The current IP address of this farm'),
),
migrations.AlterField(
model_name='farm',
name='layout',
field=models.SlugField(null=True, choices=[('aisle', 'A collection of aisles'), ('bay', 'A collection of bays'), ('tray', 'A collections of trays')]),
),
migrations.AlterField(
model_name='farm',
name='name',
field=models.CharField(null=True, max_length=100, help_text='Human readable farm name'),
),
migrations.AlterField(
model_name='farm',
name='root_server',
field=models.URLField(default='http://openag.media.mit.edu', null=True, help_text='URL of the root server to which this farm is registered'),
),
migrations.AlterField(
model_name='farm',
name='slug',
field=models.SlugField(null=True, unique=True, blank=True, help_text='Unique farm identifier', max_length=100),
),