class Employee(models.Model): employee_id = models.AutoField(primary_key=True) name = models.CharField(max_length=200) gender = models.ChoiceField(choices=GENDERS) age = models.IntegerField(max_value=80) start_date = models.DateField(input_format='%Y-%m-%d', initial=datetime.date.today) end_date = models.DateField(input_format='%Y-%m-%d', initial=datetime.date.today) """ start_year = models.IntegerField(min_value = datetime.now().year, max_value = datetime.now().year + 1) start_month = models.ChoiceField(choices=MONTHS) start_date = models.IntegerField(min_value=1, max_value=monthrange(datetime.now().year, start_month)[1]) end_year = models.IntegerField(min_value = datetime.now().year, max_value = datetime.now().year + 1) end_month = models.ChoiceField(choices=MONTHS) end_date = models.IntegerField(min_value=1, max_value=monthrange(datetime.now().year, end_month)[1]) """ work_type = models.ChoiceField(choices=WORK_TYPES) max_hours = models.IntegerField(min_value=1, max_value=24) street_address = models.CharField(max_length=500) city = models.CharField(max_length=100) state = models.CharField(max_length=100)
class Search(models.Model): town_or_postcode = models.CharField(blank=True) distance_from = models.IntegerField(blank=True) category = models.ChoiceField(blank=True) optional = models.ChoiceField(blank=True) def __unicode__(self): return self.name
class Application(models.Model): name = models.CharField(max_length=200, default=0) cityOrOrigin = models.CharField(max_length=500, default=0) booleanItem = models.BooleanField() radio = models.ChoiceField("Flight", "Speed", "Invisibility", "Telekenetic", "Healing", "Other") you = models.ChoiceField("Good", "kinda good", "neutral", "a little evil", "evil") examples = models.CharField()
class Sitter_schedule(models.Model): sitter = models.Foreignkey('Sitter', on_delete=models.CASCADE, verbose_name="시터") month = models.ChoiceField(max_length=100, choices=month_choice, verbose_name="시터가능달") day = models.ChoiceField(max_length=100, choices=day_choice, verbose_name="시터가능요일")
class Volunteer(models.model): firstname = models.CharField(max_length=128) surname = models.CharField(max_length=128) email = models.EmailField() gender = models.ChoiceField(blank=True) time_available = models.ChoiceField(blank=True) contact_number = models.IntegerField(max_length=15,blank=True) def __unicode__(self): return self.name
class Employer(models.Model): employer_id = models.AutoField(primary_key=True) name = models.CharField(max_length=200) gender = models.ChoiceField(choices=GENDERS) age = models.IntegerField(max_value=90) start_date = models.DateField(input_format='%Y-%m-%d', initial=datetime.date.today) end_date = models.DateField(input_format='%Y-%m-%d', initial=datetime.date.today) work_type = models.ChoiceField(choices=WORK_TYPES) min_hours = models.IntegerField(min_value=1, max_value=24) street_address = models.CharField(max_length=500) city = models.CharField(max_length=100) state = models.CharField(max_length=100)
class Message(django.db.models.Model): # TODO: translate the second value of every tuple to chinese CATEGORY_CHOICES = ( ('phone', 'phone'), ('bag', 'bag'), ('idcard', 'idcard'), ('bike', 'bike'), ) MESSAGE_TYPE = ((True, u'find item'), (False, u'find owner')) message_type = models.BooleanField(default=True, choices=MESSAGE_TYPE) item_name = models.CharField(max_length=40, verbose_name='item name in chinese') description = models.CharField(max_length=300) picture_file = models.ImageField(upload_to='lost_and_found', blank=True) published_date = models.DateField(auto_now_add=True) place = models.CharField(max_length=50) category = models.ChoiceField(max_length=20, choices=CATEGORY_CHOICES) publisher_name = models.CharField(max_length=20) contact_way = models.CharField(max_length=30) is_solved = models.BooleanField(default=False) def how_many_days_since_published(self): return (datetime.date.today() - published_date).days
class ExternalUserAccount(models.Model): """UserAccounts connected to the user. For easy on/off-boarding and reporting.""" # TODO: Hvis vi legger business logikken her så kan vi kalle på APIer på de andre servicene herfra. # Så denne applikasjonen har ansvaret for å opprette andre brukere, men kan kalle på APIer/gRPC/sette i redis kø andre steder. # Så slipper man at denne applikasjonen har ansvar for andre tjenester. Denne skal kun kalle. # D EXTERNAL_TYPE_CHOICE = ( ('AD', 'Active Directory'), ('TMG', 'Telemagic'), ('GPC', 'PureCloud'), ('GGS', 'Google G Suite'), ) employee = models.ForeignKey('Employee') main_type = models.ChoiceField(EXTERNAL_TYPE_CHOICE) sub_type = models.CharField(max_length=10) __username = models.CharField(max_length=320) @property def username(self): return self.__username @username.setter() def username(self, username): self.__username = username
class GitHub(models.Model): project_url = models.CharField(max_length=200) language_type = models.ChoiceField(choices=[('java', 'Java'), ('python', 'Python')]) since_datetime = models.DateTimeField(blank=True, null=True) until_datetime = models.DateTimeField(default=timezone.now)
class Opportunities(models.Model): category = models.ChoiceField() time = models.TimeField() start_date = models.DateField() end_date = models.DateField() description = models.TextField() optional = models.TextField(blank=True) def __unicode__(self): return self.name
class Partner(models.Model): AGENCY_DISTRIBUTOR_TYPES = settings.ACENCY_DISTRIBUTOR_TYPES name = models.CharField(max_length=2048, null=False, blank=False) distributor_type = models.CharField(max_length=2, choices=PARTNER_DISTRIBUTOR_TYPES) agency_types = models.ChoiceField(max_length=2, choices=PARTNER_AGENCY_TYPES) proof_of_agency_status = model.FileField() # TODO: add file arguments
class Match(models.Model): """docstring for Player""" location = [ ['NTU SPN', 'NTU Sports Center(New)'], ['NTU SPO', 'NTU Sports Center(Old)'], ['NTU PG', 'NTU Playground'], ['NTUST SP', 'NTUST Sports Center'], ['NTUST PG', 'NTUST Playground'] ] date_Y = [ ['2019'], ['2020'], ['2021'], ['2022'], ['2023'], ['2024'] ] date_M = [ ['Jan', '1'], ['Feb', '2'], ['Mar', '3'], ['Apl', '4'], ['May', '5'], ['Jun', '6'], ['Jul', '7'], ['Aug', '8'], ['Sep', '9'], ['Oct', '10'], ['Nov', '11'], ['Dec', '12'] ] date_D = [ ['First', '1st'], ['Second', '2nd'], ['Third', '3rd'], ['Forth', '4th'], ['Fifth', '5th'], ['Sixth', '6th'], ['Seventh', '7th'], ['Eighth', '8th'], ['Ninth', '9th'], ['Tenth', '10th'],['Eleventh', '11th'], ['Twelfth', '12th'], ['Thirteenth', '13th'], ['Fourteenth', '14th'], ['Fifteenth', '15th'], ['Sixteenth', '16th'], ['Seventeenth', '17th'], ['Eighteenth', '18th'], ['Nineteenth', '19th'], ['Twentieth', '20th'], ['Twenty-first', '21st'], ['Twenty-second', '22nd'],['Twenty-third', '23rd'], ['Twenty-fourth', '24th'], ['Twenty-fifth', '25th'], ['Twenty-sixth', '26th'], ['Twenty-seventh', '27th'], ['Twenty-eighth', '28th'],['Twenty-ninth', '29th'], ['Thirtieth', '30th'], ['Thirty-first', '31st'] ] # name = models.CharField(max_length=20, blank=False) location = models.ChoiceField(label = 'location', choices = location) date_Y = models.ChoiceField(label = 'Year', choices = date_Y) date_M = models.ChoiceField(label = 'Month', choices = date_M) date_D = models.ChoiceField(label = 'Date', choices = date_D) starttime1 = models.TimeField(blank=False) duration1 = models.InteferField(blank=False) starttime2 = models.TimeField(blank=False) duration2 = models.InteferField(blank=False) team1 = models.ForeignKey(Team) team2 = models.ForeignKey(Team) score = models.InteferField()"""
class Contributions(models.Model): """ Stores all cleared contributions Contributions can come in three ways """ date = models.DateField(auto_now_add=True) user = models.ForeignKeyField(User) amount = models.FloatField() stripe_token = models.CharField(max_length=32) type = models.ChoiceField(choices=CONTRIBUTION_TYPES) pledge = models.ForeignKeyField('Pledge', blank=True, null=True) level = models.ForeignKeyField('BackerLevel', blank=True, null=True)
class User(models.Model): first_name = models.CharField(max_length=60) last_name = models.CharField(max_length=60) birthday = models.DateField() gender = models.ChoiceField({ "Male": "m", "Female": "f", "Unspecified": "u" }) email = models.EmailField() password = models.CharField() username = models.CharField()
class Pet(models.Model): owner = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='주인 정보') pet_name = models.CharField(max_length=64, verbose_name='이름') gender = models.ChoiceField(widget=forms.RadioSelect(choices=CHOICES), default='남', verbose_name='성별') pet_image = models.ImageField(verbose_name='프로필 사진', null=True) introducing_pet = models.TextField(verbose_name='반려동물 소개', null=True) class Meta: db_table = 'user_Pet' verbose_name = '반려동물 정보' verbose_name_plural = '반려동물 정보'
class Animal(Content): """ The "animal" content type. Define fields you need for your new content type and specify uniqueness constraint to identify unit of this type. For example:: field1 = models.TextField() field2 = models.IntegerField() field3 = models.CharField() class Meta: unique_together = (field1, field2) """ TYPE = 'animal' MALE = 'male' FEMALE = 'female' HERMAPHRODITE = 'hermaphrodite' UNKNOWN = 'unknown' GENDER_CHOICES = ((MALE, MALE), (FEMALE, FEMALE), (HERMAPHRODITE, HERMAPHRODITE), (UNKNOWN, UNKNOWN)) species = models.CharField(max_length=255) breed = models.CharField(max_length=255) name = models.CharField(max_length=255) age = models.IntegerField() sex = models.ChoiceField(choices=GENDER_CHOICES, default=UNKNOWN) weight = models.FloatField() bio = models.TextField() shelter = models.CharField(max_length=255) reserved = models.BooleanField(default=False) picture = models.CharField(max_length=255, unique=True) class Meta: unique_together = (species, breed, name, shelter)
class Literature(models.Model): project = models.ForeignKey(Projects) literature_title = models.CharField(max_length=50) literature_authors = models.CharField(max_length=50) literature_year = models.IntegerField(max_length=4) literature_library = CharField(max_length=50) SOURCE_TYPE = ((0001,'Manual Search'), (0002,'Automated Search'), (0003,'Snowballing')) literature_source = forms.ChoiceField(choices=SOURCE_TYPE) literature_volume = models.IntegerField(max_length=5) literature_number = models.IntegerField(max_length=10) literature_pages = models.IntegerField(max_length=5) literature_month = models.IntegerField(max_length=2) literature_keywords = models.CharField(max_length=200) literature_abstracts = models.TextField(max_length=1000) literature_url = models.UrlField() LiteratureStatus = ((1001,'Unclassified'), (1002,'Included'), (1003,'Excluded'), (1004,'Extracted')) literature_status = models.ChoiceField(choices=LiteratureStatus) literature_quality = models.IntegerField(max_length=5) literature_label = models.CharField(max_length=50)
class SalesforceQuery(models.Model): QUERY_TYPE_CHOICES = ( ('OP', 'Opportunity'), ) credential = models.ForeignKey(SalesforceCredential, on_delete=models.CASCADE) query_type = models.ChoiceField(choices=QUERY_TYPE_CHOICES) def get_query(self, query): self.refresh_token() sf = Salesforce(instance=self.client.instance_url, session_id=self.client.access_token) return sf.query_all(query) def refresh_token(self): client = OAuth2Session(self.credential.id_url, token=self.credential.id_token, auto_refresh_url=settings.SALESFORCE_BASE_URL + settings.SALESFORCE_AUTHORIZATION_URL, token_updater=token_saver) def token_updater(self, token): self.credential.issued_at = token['issued_at'] self.credential.signature = token['signature'] self.credential.access_toke = token['access_token'] self.credential.save()
from django.db import models # Create your models here. class Application(models.Model): name = models.CharField(max_length=200, default=0) cityOrOrigin = models.CharField(max_length=500, default=0) booleanItem = models.BooleanField() radio = models.ChoiceField("Flight", "Speed", "Invisibility", "Telekenetic", "Healing", "Other") you = models.ChoiceField("Good", "kinda good", "neutral", "a little evil", "evil") examples = models.CharField() richOrSuperpower = models.ChoiceField("rich", "superpower") Superpowers = models.ChoiceField("Flight", "Speed", "Invisibility", "Telekenetic", "Healing", "Other") you = models.ChoiceField("Good", "kinda good", "neutral", "a little evil", "evil")
class Reminder(models.Model): name = models.CharField(max_length=25) canister = models.ChoiceField(choices=canisters) time = models.TimeField()
class Partner(models.Model): DISTRIBUTOR_AGENCY = 'Agency' DISTRIBUTOR_HOSPITAL = 'Hospital' DISTRIBUTOR_TYPES = ( ('AG', DISTRIBUTOR_AGENCY), ('HO', DISTRIBUTOR_HOSPITAL), ) AT_C3 = '501(c)3' AT_RELIGIOUS_ORGANIZATION = 'Religious Organization' AT_GOVERNMENT_ORGANIZATION = 'Government Organization' AGENCY_TYPES = ( ('50', AT_C3), ('RE', AT_RELIGIOUS_ORGANIZATION), ('GO', AT_GOVERNMENT_ORGANIZATION), ) POAS_C3_LETTER = '501(c)3 LETTER' POAS_GOOD_STANDING = 'Letter of Good Standing from Denominational Headquarters' POAS_GOVERNMENT_LETTERHEAD = 'Government Letterhead' PROOF_OF_AGENCY_STATUS_TYPE = ( ('50', C3_LETTER), ('LE', GOOD_STANDING), ('GO', ), ) DU_EMERGENCY_SUPPLIES = 'Emergency supplies for families (off site)' DU_HOMELES_SHELTER = 'Homeless shelter' DU_DOMESTIC_VIOLENCE_SHELTER = 'Domestic violence shelter' DU_ONSITE = 'On-site residential program' DU_OUTREACH = 'Outreach' DU_ALCOHOL = 'Alcohol/Drug Recovery' DU_DAYCARE = 'Daycare' DU_FOSTER_CARE = 'Foster Care' DU_OTHER = 'Other' DIAPER_USE = ( ('EM', DU_EMERGENCY_SUPPLIES), ('HO', DU_HOMELES_SHELTER), ('DO', DU_DOMESTIC_VIOLENCE_SHELTER), ('ON', DU_ONSITE), ('OU', DU_OUTREACH), ('AL', DU_ALCOHOL), ('DA', DU_DAYCARE), ('FO', DU_FOSTER_CARE), ('OT', DU_OTHER), ) PICKUP_VOLUNTEERS = 'VO' PICKUP_STAFF = 'ST' PICKUP_COURIER = 'CO' PICK_UP_METHODS = ( (PICKUP_VOLUNTEERS, 'Volunteers'), (PICKUP_STAFF, 'Staff'), (PICKUP_COURIER, 'Courier'), ) FS_FOUNDATION_GRANTS = 'FO' FS_STATE_GRANTS = 'ST' FS_FEDERAL_GRANTS = 'FE' FS_CORPORATE_DONATIONS = 'CO' FS_INDIVIDUAL_DONATIONS = 'IN' FS_OTHER = 'OT' FUNDING_SOURCES = ( (FS_FOUNDATION_GRANTS, 'Grants - Foundation'), (FS_STATE_GRANTS, 'Grants - State'), (FS_FEDERAL_GRANTS, 'Grants - Federal'), (FS_CORPORATE_DONATIONS, 'Corporate Donations'), (FS_INDIVIDUAL_DONATIONS, 'Individual Donations'), (FS_OTHER, 'Other'), ) DS_PURCHASE_RETAIL = 'PR' DS_PURCHASE_WHOLESALE = 'PH' DS_DIAPER_DRIVES = 'DD' DS_DIAPER_DRIVES_BY_OTHERS = 'DO' DS_OTHER = 'O' DIAPER_SOURCES = ( (DS_PURCHASE_RETAIL, 'Purchase Retail'), (DS_PURCHASE_WHOLESALE, 'Purchase Wholesale'), (DS_DIAPER_DRIVES, 'Diaper Drives'), (DS_DIAPER_DRIVES_BY_OTHERS, 'Diaper Drives conducted by others'), (DS_OTHER, 'Other'), ) # Angency Information name = models.CharField(max_length=2048, null=False, blank=False) distributor_type = models.CharField(max_length=2, choices=DISTRIBUTOR_TYPES) agency_types = models.ChoiceField(max_length=2, choices=AGENCY_TYPES) proof_of_agency_status = model.FileField() # TODO: add file arguments proof_of_agency_status_type = models.CharField( max_length=CHOICE_LENGTH, choices=PROOF_OF_AGENCY_STATUS_TYPE) agency_mission = models.CharField(max_length=DESCRIPTION_LENGTH) address_1 = models.CharField(max_length=MEDIUM_LENGTH) address_2 = models.CharField(max_length=MEDIUM_LENGTH) city = models.CharField(max_length=NAME_LENGTH) state = models.CharField(max_length=2, choices=load_choices('./states.txt')) zip_code = models.CharField(max_length=ZIP_LENGTH) # Media Information website = models.URLField() facebook = models.CharField( max_length=NAME_LENGTH, help_text="Facebook page name (DO NOT include the URL)") twitter = models.CharField(max_length=NAME_LENGTH, help_text="Twitter Handle") # Agency Stability founded = RangeIntegerField(min=1800, max=get_current_year()) form_990 = models.FileField() program_name = models.CharField(max_length=NAME_LENGTH) program_description = models.CharField(max_length=DESCRIPTION_LENGTH) # TODO: age (possibly omit) case_management = models.BooleanField() evidence_based = models.BooleanField() evidence_based_description = models.CharField( max_length=DESCRIPTION_LENGTH) program_client_improvement = models.CharField( max_length=DESCRIPTION_LENGTH) diaper_use = models.CharField(max_length=CHOICE_LENGTH, choices=DIAPER_USE) other_diaper_use = models.CharField(max_length=DESCRIPTION_LENGTH) currently_provide_diapers = models.BooleanField() turn_away_child_care = models.BooleanField() # Program Address program_address1 = models.CharField(max_length=MEDIUM_LENGTH) program_address2 = models.CharField(max_length=MEDIUM_LENGTH) program_city = models.CharField(max_length=NAME_LENGTH) program_state = models.CharField(max_length=CHOICE_LENGTH, choices=load_choices('./states.txt')) program_zip_code = models.CharField(max_length=ZIP_LENGTH) # Organizational Capacity max_serve = models.IntegerField( help_text='Maximum number of people this organization can serve') incorporate_plan = models.CharField(max_length=DESCRIPTION_LENGTH) responsible_staff_position = models.BooleanField() storage_space = models.BooleanField() description_of_storage_space = models.CharField( max_length=DESCRIPTION_LENGTH) trusted_pickup = models.BooleanField() # Population served incmome_requirement_description = models.BooleanField() serve_income_circumstances = models.BooleanField() income_verification = models.BooleanField() internal_diaper_bank = models.BooleanField() # TODO: Is db=diaper bank? maac = models.BooleanField() # Ethnic composition of those served population_black = PercentageField() population_white = PercentageField() population_hispanic = PercentageField() population_asian = PercentageField() population_american_indian = PercentageField() population_island = PercentageField() population_multi_racial = PercentageField() population_other = PercentageField() # Zips served zip_codes_served = models.CharField(max_length=MEDIUM_LENGTH) # Poverty Information at_fpl_or_below = PercentageField() above_1_2_times_fpl = PercentageField() greater_2_times_fpl = PercentageField() poverty_unknown = PercentageField() # Ages served ages_served = models.CharField(max_length=MEDIUM_LENGTH) #Executive Director executive_director_name = models.CharField(max_length=MEDIUM_LENGTH) executive_director_phone = PhoneNumberField() executive_director_email = models.EmailField() # Program Contact Person program_contact_name = models.CharField(max_length=MEDIUM_LENGTH) program_contact_phone = PhoneNumberField() program_contact_mobile = PhoneNumberField() program_contact_email = models.EmailField() # Diaper Pickup Person pick_up_method = models.CharField(max_length=CHOICE_LENGTH, choices=PICK_UP_METHODS) pick_up_contact_name = models.CharField(max_length=MEDIUM_LENGTH) pick_up_contact_phone = PhoneNumberField() pick_up_contact_email = models.EmailField() # Agency Distribution Information distribution_times = models.CharField(max_length=MEDIUM_LENGTH) new_client_times = models.CharField(max_length=MEDIUM_LENGTH) more_docs_required = models.CharField(max_length=MEDIUM_LENGTH) # Sources of Funding funding_sources = models.ChoiceField(max_length=CHOICE_LENGTH, choices=FUNDING_SOURCES) sources_of_diapers = models.ChoiceField(max_length=CHOICE_LENGTH, choices=DIAPER_SOURCES) diaper_budget = models.BooleanField() diaper_funding_source = models.BooleanField()