Skip to content

Commit

Permalink
Add explanatory comments for weird char field length limits
Browse files Browse the repository at this point in the history
  • Loading branch information
waxlamp committed Jul 24, 2024
1 parent 38d1a29 commit 50d80e6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dandiapi/api/models/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,20 @@
class AuditRecord(models.Model):
timestamp = models.DateTimeField(auto_now_add=True)
dandiset_id = models.IntegerField()

# GitHub enforces a 39 character limit on usernames (see, e.g.,
# https://docs.github.com/en/enterprise-cloud@latest/admin/managing-iam/iam-configuration-reference/username-considerations-for-external-authentication).
username = models.CharField(max_length=39)

# According to RFC 5321 (https://www.rfc-editor.org/rfc/rfc5321.txt),
# section 4.5.3.1.3, an email address "path" is limited to 256 octets,
# including the surrounding angle brackets. Without the brackets, that
# leaves 254 characters for the email address itself.
user_email = models.CharField(max_length=254)

# The signup questionnaire imposes a 150 character limit on both first and
# last names; together with a space to separate them, that makes a 301
# character limit on the full name.
user_fullname = models.CharField(max_length=301)
record_type = models.CharField(max_length=32, choices=AUDIT_RECORD_CHOICES)
details = models.JSONField(blank=True)
Expand Down

0 comments on commit 50d80e6

Please sign in to comment.