コード例 #1
0
ファイル: Inventory.py プロジェクト: laeblab/GBEX_BGI
class Plasmid(InventoryItem):
    CommonName = models.TextField(blank=True, null=True)
    Genotype = models.TextField(blank=True, null=True)
    Antibiotic = models.ManyToManyField(AntibioticOption, blank=True)
    Genbank_file = ResumableFileField(blank=True,
                                      null=True,
                                      upload_to=get_upload_path,
                                      max_length=500)

    order = [
        *inventory_order, 'CommonName', 'Antibiotic', 'Genbank_file', 'Batches'
    ]
    symbol = "PL"
    col_display_func_dict = {
        'Batches':
        lambda item:
        f"<a href='{reverse('list_PlasmidBatch', kwargs=dict(parent_pk=item.pk))}'>{item.plasmidbatch_set.filter(archived=False).count()} batches</a>",
        'Genbank_file':
        lambda item:
        f"<a href='/downloads/{item.Genbank_file}'>{str(item.Genbank_file).split('/')[-1]}</a>",
        'Antibiotic':
        lambda item: ", ".join(ab.name for ab in item.Antibiotic.all())
        if item.Antibiotic.all() else "",
    }

    col_html_string = ['Genbank_file', 'Batches']
    col_read_only = [*default_readonly, 'Batches']

    widgets = {
        **default_widgets,
        'Antibiotic':
        autocomplete.ModelSelect2Multiple(
            url=reverse_lazy('AntibioticOption-autocomplete')),
    }
コード例 #2
0
ファイル: Inventory.py プロジェクト: DumData/GBEX
class Strain(GBEXModelBase):
    Species = models.ForeignKey(SpeciesOption, on_delete=models.PROTECT)
    Subtype = models.TextField(blank=True, null=True)
    Description = models.TextField(blank=True, null=True)
    Plasmids = models.ManyToManyField(Plasmid, blank=True)
    ParentStrain = models.ForeignKey("self",
                                     null=True,
                                     on_delete=models.PROTECT)
    Genbank_file = ResumableFileField(blank=True,
                                      null=True,
                                      upload_to=get_upload_path,
                                      max_length=500)

    menu_label = menu_label
    order = [
        *default_order, 'Species', 'Subtype', 'Description', 'Plasmids',
        'Genbank_file'
    ]
    symbol = "ST"
    col_display_func_dict = {
        'Plasmids':
        lambda item: ", ".join(ab.name for ab in item.Plasmids.all())
        if item.Plasmids.all() else "",
    }
    widgets = {
        **default_widgets,
        'Species':
        autocomplete.ModelSelect2(
            url=reverse_lazy('SpeciesOption-autocomplete')),
        'Plasmids':
        autocomplete.ModelSelect2Multiple(
            url=reverse_lazy('Plasmid-autocomplete')),
    }
コード例 #3
0
class ExperimentBase(GBEXModelBase):
    Description = models.TextField(blank=True, null=True)
    RunDate = models.DateField(null=True, blank=True)
    Data_file = ResumableFileField(blank=True,
                                   null=True,
                                   upload_to=get_upload_path,
                                   max_length=500)
    Status = models.TextField(blank=True, null=True)

    menu_label = "Experiments"
    widgets = ExperimentWidgets
    col_display_func_dict = ExperimentCDFDict
    col_html_string = ExperimentCHString
    order = ExperimentOrder

    class Meta:
        abstract = True
コード例 #4
0
class SOP(GBEXModelBase):
	Summary = models.TextField(blank=True, null=True)
	Tags = models.ManyToManyField(SOPTag, blank=True)
	SOP_file = ResumableFileField(blank=True, null=True, upload_to=get_upload_path, max_length=500)

	menu_label = menu_label
	order = [*default_order, 'Summary', 'Tags', 'SOP_file']
	symbol = "SOP"
	col_display_func_dict = {
		'Tags': lambda item: ", ".join(ab.name for ab in item.Tags.all()) if item.Tags.all() else "",
		'SOP_file': lambda
			item: f"<a href='/downloads/{item.SOP_file}'>{str(item.SOP_file).split('/')[-1]}</a>",

	}
	widgets = {
		**default_widgets,
		'Tags': autocomplete.ModelSelect2Multiple(url=reverse_lazy('SOPTag-autocomplete')),
	}

	col_html_string = ['SOP_file',]
コード例 #5
0
ファイル: Inventory.py プロジェクト: DumData/GBEX
class Plasmid(GBEXModelBase):
    Description = models.TextField(blank=True, null=True)
    Genbank_file = ResumableFileField(blank=True,
                                      null=True,
                                      upload_to=get_upload_path,
                                      max_length=500)

    menu_label = menu_label
    order = [*default_order, 'Description', 'Genbank_file', 'Batches']
    symbol = "PL"
    col_display_func_dict = {
        'Batches':
        lambda item:
        f"<a href='{reverse('list_PlasmidBatch', kwargs=dict(parent_pk=item.pk))}'>{item.plasmidbatch_set.filter(archived=False).count()} batches</a>",
        'Genbank_file':
        lambda item:
        f"<a href='/downloads/{item.Genbank_file}'>{str(item.Genbank_file).split('/')[-1]}</a>",
    }

    col_html_string = ['Genbank_file', 'Batches']
    col_read_only = [*default_readonly, 'Batches']
コード例 #6
0
ファイル: Experiments.py プロジェクト: DumData/GBEX
class Fermentation(GBEXModelBase):
    RunDate = models.DateTimeField(null=True, blank=True)
    Strain = models.ForeignKey(Strain,
                               on_delete=models.PROTECT,
                               null=True,
                               blank=True)
    ReactorVessel = models.CharField(choices=ReactorVessel,
                                     blank=True,
                                     null=True,
                                     max_length=10)
    Data_file = ResumableFileField(blank=True,
                                   null=True,
                                   upload_to=get_upload_path,
                                   max_length=500)

    menu_label = menu_label
    order = [*default_order, 'RunDate', 'Strain', 'ReactorVessel', 'Data_file']
    symbol = "FE"
    widgets = {
        **default_widgets,
        'Strain':
        autocomplete.ModelSelect2(url=reverse_lazy('Strain-autocomplete')),
    }
コード例 #7
0
ファイル: Inventory.py プロジェクト: laeblab/GBEX_BGI
class Strain(InventoryItem):
    CommonName = models.TextField(blank=True, null=True)
    Species = models.ForeignKey(SpeciesOption, on_delete=models.PROTECT)
    Subtype = models.TextField(blank=True, null=True)
    Antibiotic = models.ManyToManyField(AntibioticOption, blank=True)
    Genotype = models.TextField(blank=True, null=True)
    Vendor = models.ForeignKey(VendorOption,
                               blank=True,
                               null=True,
                               on_delete=models.PROTECT)
    CatalogNo = models.TextField(blank=True, null=True)
    Plasmids = models.ManyToManyField(Plasmid, blank=True)
    ParentStrain = models.ForeignKey("self",
                                     null=True,
                                     blank=True,
                                     on_delete=models.PROTECT)
    Genbank_file = ResumableFileField(blank=True,
                                      null=True,
                                      upload_to=get_upload_path,
                                      max_length=500)

    order = [
        *inventory_order, 'CommonName', 'Species', 'Subtype', 'ParentStrain',
        'Antibiotic', 'Genotype', 'Plasmids', 'Genbank_file', 'Vendor',
        'CatalogNo', 'Batches'
    ]
    symbol = "ST"
    col_display_func_dict = {
        'Plasmids':
        lambda item: ", ".join(ab.name for ab in item.Plasmids.all())
        if item.Plasmids.all() else "",
        'Antibiotic':
        lambda item: ", ".join(ab.name for ab in item.Antibiotic.all())
        if item.Antibiotic.all() else "",
        'Batches':
        lambda item:
        f"<a href='{reverse('list_StrainBatch', kwargs=dict(parent_pk=item.pk))}'>{item.strainbatch_set.filter(archived=False).count()} batches</a>",
        'Genbank_file':
        lambda item:
        f"<a href='/downloads/{item.Genbank_file}'>{str(item.Genbank_file).split('/')[-1]}</a>",
    }
    widgets = {
        **default_widgets,
        'Species':
        autocomplete.ModelSelect2(
            url=reverse_lazy('SpeciesOption-autocomplete')),
        'Vendor':
        autocomplete.ModelSelect2(
            url=reverse_lazy('VendorOption-autocomplete')),
        'ParentStrain':
        autocomplete.ModelSelect2(url=reverse_lazy('Strain-autocomplete')),
        'Plasmids':
        autocomplete.ModelSelect2Multiple(
            url=reverse_lazy('Plasmid-autocomplete')),
        'Antibiotic':
        autocomplete.ModelSelect2Multiple(
            url=reverse_lazy('AntibioticOption-autocomplete')),
    }

    col_html_string = ['Genbank_file', 'Batches']
    col_read_only = [*default_readonly, 'Batches']