Classes repetitive

What's the best way to shorten/one class a multiple class/model? I have seen our line of codes repetitive a same class with just different class name but with same arguments inside.
# a_usi
class PAR_a_usiUpload(models.Model):
file_attach = models.FileField(upload_to='preaud/a_aud/', blank=True, null=True)
a_usi_rel = models.ForeignKey(
PreAuditRequirements,
verbose_name="a_usi_rel",
on_delete = models.CASCADE,
related_name= 'a_usi_rel',
null=True)
date_created = models.DateTimeField(auto_now_add=True)
date_modified = models.DateTimeField(auto_now=True)
# end


# a_ces
class PAR_a_cesUpload(models.Model):
...
# end

# a_aabaa
class PAR_a_aabaaUpload(models.Model):
...
# end
# a_usi
class PAR_a_usiUpload(models.Model):
file_attach = models.FileField(upload_to='preaud/a_aud/', blank=True, null=True)
a_usi_rel = models.ForeignKey(
PreAuditRequirements,
verbose_name="a_usi_rel",
on_delete = models.CASCADE,
related_name= 'a_usi_rel',
null=True)
date_created = models.DateTimeField(auto_now_add=True)
date_modified = models.DateTimeField(auto_now=True)
# end


# a_ces
class PAR_a_cesUpload(models.Model):
...
# end

# a_aabaa
class PAR_a_aabaaUpload(models.Model):
...
# end
can this be done or do I just go with it?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server