How to use the django.db.models.IntegerField function in Django

To help you get started, we’ve selected a few Django examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefectDojo / django-DefectDojo / dojo / models.py View on Github external
url = models.URLField(max_length=2000, verbose_name="JIRA URL", help_text="For configuring Jira, view: https://defectdojo.readthedocs.io/en/latest/features.html#jira-integration")
    #    product = models.ForeignKey(Product)
    username = models.CharField(max_length=2000)
    password = models.CharField(max_length=2000)
    #    project_key = models.CharField(max_length=200,null=True, blank=True)
    #    enabled = models.BooleanField(default=True)
    default_issue_type = models.CharField(max_length=9,
                                          choices=(
                                              ('Task', 'Task'),
                                              ('Story', 'Story'),
                                              ('Epic', 'Epic'),
                                              ('Spike', 'Spike'),
                                              ('Bug', 'Bug')),
                                          default='Bug')
    epic_name_id = models.IntegerField(help_text="To obtain the 'Epic name id' visit https:///rest/api/2/field and search for Epic Name. Copy the number out of cf[number] and paste it here.")
    open_status_key = models.IntegerField(help_text="To obtain the 'open status key' visit https:///rest/api/latest/issue//transitions?expand=transitions.fields")
    close_status_key = models.IntegerField(help_text="To obtain the 'open status key' visit https:///rest/api/latest/issue//transitions?expand=transitions.fields")
    info_mapping_severity = models.CharField(max_length=200, help_text="Maps to the 'Priority' field in Jira. For example: Info")
    low_mapping_severity = models.CharField(max_length=200, help_text="Maps to the 'Priority' field in Jira. For example: Low")
    medium_mapping_severity = models.CharField(max_length=200, help_text="Maps to the 'Priority' field in Jira. For example: Medium")
    high_mapping_severity = models.CharField(max_length=200, help_text="Maps to the 'Priority' field in Jira. For example: High")
    critical_mapping_severity = models.CharField(max_length=200, help_text="Maps to the 'Priority' field in Jira. For example: Critical")
    finding_text = models.TextField(null=True, blank=True, help_text="Additional text that will be added to the finding in Jira. For example including how the finding was created or who to contact for more information.")
    accepted_mapping_resolution = models.CharField(null=True, blank=True, max_length=300, help_text="JIRA resolution names (comma-separated values) that maps to an Accepted Finding")
    false_positive_mapping_resolution = models.CharField(null=True, blank=True, max_length=300, help_text="JIRA resolution names (comma-separated values) that maps to a False Positive Finding")

    @property
    def accepted_resolutions(self):
        return [m.strip() for m in (self.accepted_mapping_resolution or '').split(',')]

    @property
    def false_positive_resolutions(self):
github benbest86 / myewb2 / myewb / apps / champ / models.py View on Github external
position = models.CharField("Position",
                                max_length=255, null=True, blank=True)
    ewb = models.CharField("EWBer who initiated",
                           max_length=255, null=True, blank=True)
    purpose = models.CharField("Purpose",
                               max_length=255, null=True, blank=True)
    learned = models.TextField("What we learned",
                               null=True, blank=True)
    
class AdvocacyLettersMetrics(Metrics):
    metricname = "adv"
    signatures = models.IntegerField("Number of petition signatures",
                                     blank=True, null=True)
    letters = models.IntegerField("Number of letters sent to decision-makers",
                                  blank=True, null=True)
    editorials = models.IntegerField("Number of letters written to editors/media outlets",
                                     blank=True, null=True,
                                     help_text="(even if unpublished)")
    other = models.TextField("Other",
                             blank=True, null=True,
                             help_text="please specify numbers and content")
    
class PublicationMetrics(Metrics):
    metricname = "pub"
    outlet = models.CharField(verbose_name="Name of media outlet",
                              max_length=255, null=True, blank=True)
    type = models.CharField("What kind of media?",
                            max_length=255, null=True, blank=True,
                            help_text="ie television, op-ed, photo, letter to the editor, newspaper story...")
    location = models.CharField("Location",
                                max_length=255, null=True, blank=True,
                                help_text='e Montreal, National News, provincial...')
github karamanolev / WhatManager2 / what_meta / models.py View on Github external
return artist


class WhatTorrentGroup(models.Model):
    retrieved = models.DateTimeField()
    artists = models.ManyToManyField(WhatArtist, through='WhatTorrentArtist')
    wiki_body = models.TextField()
    wiki_image = models.CharField(max_length=255)
    joined_artists = models.TextField()
    name = models.CharField(max_length=300)  # Indexed with a RunSQL migration
    year = models.IntegerField()
    record_label = models.CharField(max_length=80)
    catalogue_number = models.CharField(max_length=80)
    release_type = models.IntegerField()
    category_id = models.IntegerField()
    category_name = models.CharField(max_length=32)
    time = models.DateTimeField()
    vanity_house = models.BooleanField(default=False)
    info_json = models.TextField()
    # Will contain the JSON for the "torrent" response field if this was fetched through
    # action=torrentgroup. If it was created from an action=torrent, then it will be NULL
    torrents_json = models.TextField(null=True)

    @cached_property
    def info(self):
        return ujson.loads(self.info_json)

    @cached_property
    def torrents(self):
        return ujson.loads(self.torrents_json)
github ecds / voyages / voyages / apps / voyage / legacy_models.py View on Github external
male6 = models.IntegerField(null=True, blank=True)
    men6 = models.IntegerField(null=True, blank=True)
    women6 = models.IntegerField(null=True, blank=True)
    boy6 = models.IntegerField(null=True, blank=True)
    girl6 = models.IntegerField(null=True, blank=True)
    crew2 = models.IntegerField(null=True, blank=True)
    infantm3 = models.IntegerField(null=True, blank=True)
    infantf3 = models.IntegerField(null=True, blank=True)
    sladied1 = models.IntegerField(null=True, blank=True)
    sladied2 = models.IntegerField(null=True, blank=True)
    sladied3 = models.IntegerField(null=True, blank=True)
    sladied4 = models.IntegerField(null=True, blank=True)
    sladied5 = models.IntegerField(null=True, blank=True)
    sladied6 = models.IntegerField(null=True, blank=True)
    adult3 = models.IntegerField(null=True, blank=True)
    insurrec = models.IntegerField(null=True, blank=True)
    child5 = models.IntegerField(null=True, blank=True)
    female5 = models.IntegerField(null=True, blank=True)
    male5 = models.IntegerField(null=True, blank=True)
    men5 = models.IntegerField(null=True, blank=True)
    women5 = models.IntegerField(null=True, blank=True)
    boy5 = models.IntegerField(null=True, blank=True)
    girl5 = models.IntegerField(null=True, blank=True)
    arrport2 = models.ForeignKey(Ports, null=True, db_column='arrport2', related_name='voyages_arrport2', blank=True)
    infant3 = models.IntegerField(null=True, blank=True)
    infant1 = models.IntegerField(null=True, blank=True)
    adult5 = models.IntegerField(null=True, blank=True)
    adult2 = models.IntegerField(null=True, blank=True)
    adult4 = models.IntegerField(null=True, blank=True)
    infant4 = models.IntegerField(null=True, blank=True)
    crew = models.IntegerField(null=True, blank=True)
    suggestion = models.NullBooleanField(null=True, blank=True)
github diamm / diamm / diamm / models / migrate / models.py View on Github external
class Meta:
        managed = False
        db_table = 'alPerson'


class Alpersonrelationship(models.Model):
    alpersonrelationshipkey = models.IntegerField(db_column='alPersonRelationshipKey', primary_key=True)  # Field name made lowercase.
    relationshiptype = models.TextField(db_column='relationshipType', blank=True, null=True)  # Field name made lowercase.

    class Meta:
        managed = False
        db_table = 'alPersonRelationship'


class Alprovenance(models.Model):
    alprovenancekey = models.IntegerField(db_column='alProvenanceKey', primary_key=True)  # Field name made lowercase.
    country = models.TextField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'alProvenance'


class Alsettype(models.Model):
    alsettypekey = models.IntegerField(db_column='alsetTypeKey', primary_key=True)  # Field name made lowercase.
    description = models.TextField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'alSetType'
github ilavender / sensu_drive / isubscribe / models.py View on Github external
email = models.EmailField(max_length=70, null=True, blank=True, unique=True)
    slack_uid = models.CharField(max_length=70, null=True, blank=True)
    
    def __str__(self):
        return "%s" % (self.pk)


  
class Subscribe(models.Model):
    entity = models.CharField(max_length=256, blank=False, null=False)
    STATUS_CHOICES = (
        (0, 'okay'),
        (1, 'warning'),
        (2, 'critical'),
    )
    status = models.IntegerField(
        choices=STATUS_CHOICES        
    )
    friends = models.ManyToManyField(User)
    
    def __str__(self):
        return "entity: [%s] status: [%s]" % (self.entity, self.status)
    

class Rule(models.Model):
    owner = models.ForeignKey(User)
    name = models.CharField(max_length=256, blank=False, null=False)
    regex_string = models.CharField(blank=False, null=False, max_length=512)
    STATUS_CHOICES = (
        (1, 'warning'),
        (2, 'critical'),
    )
github dimagi / commcare-hq / custom / icds_reports / models / aggregate.py View on Github external
usage_awc_num_active = models.IntegerField(null=True)
    usage_time_pse = models.DecimalField(max_digits=64, decimal_places=16, null=True)
    usage_time_gmp = models.DecimalField(max_digits=64, decimal_places=16, null=True)
    usage_time_bp = models.DecimalField(max_digits=64, decimal_places=16, null=True)
    usage_time_pnc = models.DecimalField(max_digits=64, decimal_places=16, null=True)
    usage_time_ebf = models.DecimalField(max_digits=64, decimal_places=16, null=True)
    usage_time_cf = models.DecimalField(max_digits=64, decimal_places=16, null=True)
    usage_time_of_day_pse = models.TimeField(null=True)
    usage_time_of_day_home_visit = models.TimeField(null=True)
    vhnd_immunization = models.IntegerField(null=True)
    vhnd_anc = models.IntegerField(null=True)
    vhnd_gmp = models.IntegerField(null=True)
    vhnd_num_pregnancy = models.IntegerField(null=True)
    vhnd_num_lactating = models.IntegerField(null=True)
    vhnd_num_mothers_6_12 = models.IntegerField(null=True)
    vhnd_num_mothers_12 = models.IntegerField(null=True)
    vhnd_num_fathers = models.IntegerField(null=True)
    ls_supervision_visit = models.IntegerField(null=True)
    ls_num_supervised = models.IntegerField(null=True)
    ls_awc_location_long = models.DecimalField(max_digits=64, decimal_places=16, null=True)
    ls_awc_location_lat = models.DecimalField(max_digits=64, decimal_places=16, null=True)
    ls_awc_present = models.IntegerField(null=True)
    ls_awc_open = models.IntegerField(null=True)
    ls_awc_not_open_aww_not_available = models.IntegerField(null=True)
    ls_awc_not_open_closed_early = models.IntegerField(null=True)
    ls_awc_not_open_holiday = models.IntegerField(null=True)
    ls_awc_not_open_unknown = models.IntegerField(null=True)
    ls_awc_not_open_other = models.IntegerField(null=True)
    infra_last_update_date = models.DateField(null=True)
    infra_type_of_building = models.TextField(null=True)
    infra_type_of_building_pucca = models.IntegerField(null=True)
    infra_type_of_building_semi_pucca = models.IntegerField(null=True)
github ozgurlukicin / ozgurlukicin / beyin2 / models.py View on Github external
)

class Idea(models.Model):
    title = models.CharField(max_length = 512, verbose_name = "Başlık")
    description = models.TextField(verbose_name = "Açıklama")
    dateSubmitted = models.DateTimeField("date submitted", default=datetime.now())
    submitter = models.ForeignKey(User, related_name="idea_submitter")
    status = models.ForeignKey("Status", blank=True, null=True, verbose_name = "Durum")
    category = models.ForeignKey("Category", blank=True, null=True, verbose_name = "Kategori")
    duplicate = models.ForeignKey("self", blank=True, null=True)
    is_duplicate = models.BooleanField("Idea Duplicate", default=False)
    is_hidden = models.BooleanField("Hiddden", default=False)
    topic = models.ForeignKey(Topic, related_name="Idea_topic")
    tags = models.ManyToManyField(Tag, blank=True, null=True, verbose_name = "Etiketler")
    # percent will be processed as %UUU,%NNN %DDD
    vote_percent = models.IntegerField(default=0)
    vote_value = models.IntegerField(default=0)

    def __unicode__(self):
        return self.title

    def get_absolute_url(self):
        return "/beyin2/%s/detail/" % self.id

    def get_duplications(self):
        return Idea.objects.filter(duplicate=self)

    def get_vote_text(self):
        pos_votes = Vote.objects.filter( vote = 'U', idea = self).count()
        notr_votes = Vote.objects.filter( vote = 'N', idea = self ).count()
        neg_votes = Vote.objects.filter( vote = 'D', idea = self ).count()
        return "Olumlu: %s Kararsız: %s Olumsuz: %s" %(pos_votes, notr_votes, neg_votes )
github nscozzaro / physics-is-beautiful / curricula / models / structure.py View on Github external
class CloneMeta:
        children_field = 'units'

    class Name:
        DEFAULT = 'Default Curriculum'

    objects = CurriculumQuerySet.as_manager()

    uuid = ShortUUIDField()
    name = models.CharField(max_length=200, db_index=True)
    published_on = models.DateTimeField('date published', null=True, blank=True)
    image = models.ImageField(blank=True)
    cover_photo = models.ImageField(blank=True)
    description = models.TextField(blank=True, null=True, default='')
    number_of_learners_denormalized = models.IntegerField(default=0, null=True, blank=True)

    author = models.ForeignKey(User)
    collaborators = models.ManyToManyField(Profile, related_name='coauthored_curricula')

    # settings
    setting_units_unlocked = models.BooleanField(default=False, blank=True)
    setting_modules_unlocked = models.BooleanField(default=False, blank=True)
    setting_lessons_unlocked = models.BooleanField(default=False, blank=True)
    setting_publically = models.BooleanField(default=False, blank=True)

    def count_number_of_learners(self, LessonProgressClass):
        lps_count = LessonProgressClass.objects.filter(status=30,  # LessonProgress.Status.COMPLETE
                                                       lesson__module__unit__curriculum=self). \
            values('profile').distinct().count()

        self.number_of_learners_denormalized = lps_count
github jeremyjbowers / django-preps / preps / apps / sports / tennis / models.py View on Github external
import datetime
from django.db import models
from django.template.defaultfilters import slugify
from preps.apps.models import ModelBase
from preps.apps.sports.models import Season, School, GameBase, Sport, Player, Conference
from preps.apps.utils import functions as preps_utils

class Match(GameBase):
    '''
    A representation of a Tennis match.
    A Tennis match can be best of 3 or best of 5 sets.
    '''
    season                          = models.ForeignKey(Season, related_name="tennis_match_season")
    home_set_1_score                = models.IntegerField(default=0, blank=True)
    home_set_2_score                = models.IntegerField(default=0, blank=True)
    home_set_3_score                = models.IntegerField(default=0, blank=True)
    home_set_4_score                = models.IntegerField(default=0, blank=True)
    home_set_5_score                = models.IntegerField(default=0, blank=True)
    away_set_1_score                = models.IntegerField(default=0, blank=True)
    away_set_2_score                = models.IntegerField(default=0, blank=True)
    away_set_3_score                = models.IntegerField(default=0, blank=True)
    away_set_4_score                = models.IntegerField(default=0, blank=True)
    away_set_5_score                = models.IntegerField(default=0, blank=True)
    home_sets_won                   = models.IntegerField(default=0, blank=True)
    away_sets_won                   = models.IntegerField(default=0, blank=True)
    home_player                     = models.ForeignKey(Player, related_name="tennis_home_player", null=True)
    away_player                     = models.ForeignKey(Player, related_name="tennis_away_player", null=True)
    
    class Meta:
        verbose_name_plural = 'matches'
    
    def __unicode__(self):