Last modified: Jan 10, 2023 By Alexander Williams

Django Models help_text Examples

Example 1


class Filing(models.Model):

    # This is set from the index file.
    submission_year = models.IntegerField(blank=False, null=False, default=0, help_text="Index file year")

    # Verbatim fields set from the csv file
    return_id = models.CharField(max_length=8, blank=False, null=False, default="", help_text="Return ID")
    filing_type = models.CharField(max_length=5, blank=False, null=False, default="", help_text="Always EFILE")
    ein = models.CharField(max_length=9, blank=False, null=False, default="", help_text="Employer ID number")
    tax_period = models.IntegerField(blank=False, null=False, default=0, help_text="Month filed, YYYYMM")
    sub_date = models.CharField(max_length=22, blank=False, null=False, default="", help_text="Submitted date in "
                                "YYYY-MM-DD format. But submitted to whom?")
    taxpayer_name = models.CharField(max_length=100, blank=False, null=False, default="", help_text="Organization name")
    return_type = models.CharField(max_length=5, blank=False, null=False, default="", help_text="Return type")
    dln = models.CharField(max_length=14, blank=False, null=False, default="", help_text="Document Locator Number")
    object_id = models.CharField(max_length=18, blank=False, null=False, default="", help_text="IRS-assigned unique ID")

    # fields we set after processing
    schema_version = models.TextField(null=True, help_text="schema version as it appears, e.g. 2015v2.1 ") 
    tax_year = models.IntegerField(blank=True, null=True, help_text="The year of the tax period, set this from "
                                   "tax_period")
    
    # Processing notes
    parse_started = models.NullBooleanField(help_text="Set this true when parsing begins")
    parse_complete = models.NullBooleanField(null=True, help_text="Set true when data stored")
    process_time = models.DateTimeField(null=True, help_text="When was parsing complete?")
    is_error = models.NullBooleanField(help_text="Was an error of any type encountered during parsing")
    key_error_count = models.IntegerField(blank=True, null=True, help_text="Number of key errors found")
    error_details = models.TextField(null=True, help_text="Describe error condition")

Example 2


class Arg(models.Model):
    api_name = models.ForeignKey(WebAPI, on_delete=models.CASCADE)
    arg_types = ['int', 'float', 'string', 'infile', 'outfile', ]
    arg_name = models.CharField(max_length=100, help_text="Argument Name")
    arg_type = models.CharField(
        max_length=20,
        choices=zip(arg_types, arg_types),
        default="string",
        help_text="Argument Type"
    )
    arg_default = models.CharField(max_length=100, default='None', help_text="Default Value")
    arg_format = models.CharField(max_length=100, default='None', help_text="Format Example: ref_rna.exp_matrix")

    def __str__(self):
        return self.arg_name

Example 3


class StorageObject(models.Model):

    source_url = models.URLField(editable=False,
                                 default=settings.DJANGO_URL,
                                 help_text="(Read-only) base URL for the server where the master copy of " \
                                           "the associated language resource is located.")

    identifier = models.CharField(max_length=64, null=True, blank=True,
                                  editable=False, help_text="(Read-only) unique " \
                                                            "identifier for this storage object instance.")

    created = models.DateTimeField(auto_now_add=True, editable=False,
                                   help_text="(Read-only) creation date for this storage object instance.")

    modified = models.DateTimeField(editable=False, auto_now=True,
                                    help_text="(Read-only) last modification date of the metadata XML " \
                                              "for this storage object instance.")

    checksum = models.CharField(blank=True, null=True, max_length=32,
                                help_text="(Read-only) MD5 checksum of the binary data for this " \
                                          "storage object instance.")

    digest_checksum = models.CharField(blank=True, null=True, max_length=32,
                                       help_text="(Read-only) MD5 checksum of the digest zip file containing the " \
                                                 "global serialized storage object and the metadata XML for this " \
                                                 "storage object instance.")

    digest_modified = models.DateTimeField(editable=False, null=True, blank=True,
                                           help_text="(Read-only) last modification date of digest zip " \
                                                     "for this storage object instance.")

    digest_last_checked = models.DateTimeField(editable=False, null=True, blank=True,
                                               help_text="(Read-only) last update check date of digest zip " \
                                                         "for this storage object instance.")

    revision = models.PositiveIntegerField(default=1, help_text="Revision " \
                                                                "or version information for this storage object instance.")

    metashare_version = models.CharField(max_length=32, editable=False,
                                         default=settings.METASHARE_VERSION,
                                         help_text="(Read-only) META-SHARE version used with the storage object instance.")

    legacy_resource = models.BooleanField(
        help_text='Specifies whether the resource is collected by ELRC 1',
        default=False)

    def _get_master_copy(self):