-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Contact Us API #74
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,21 @@ def __str__(self): | |
return f"Alias {self.id}: {self.tag} {self.alias}" | ||
|
||
|
||
class Contact(models.Model): | ||
email = models.CharField(max_length=128, unique=True) | ||
text = models.TextField(max_length=4096, null=True, blank=True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For TextField and CharFields, best practice is to ONLY use "blank=True" - that way the row will always have an empty string for missing data in that field. If you allow null, then you would have to check for null and '' to decide if you don't have a value. |
||
logo_url = models.URLField(max_length=2048, blank=True) | ||
name = models.CharField(max_length=128, unique=True) | ||
organization = models.CharField(max_length=128, unique=True) | ||
project_url = models.URLField(max_length=2048, blank=True) | ||
|
||
class Meta: | ||
verbose_name = "Contact" | ||
verbose_name_plural = "Contacts" | ||
|
||
def __str__(self): | ||
return f"Contact {self.id}: {self.email} {self.text} {self.logo_url} {self.name} {self.organization} {self.project_url}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ummm that's the entire model. Not really best practice. Why are you returning EVERYTHING in str? |
||
|
||
# ###### FAQS ########### | ||
class FAQ(models.Model): | ||
FAQ_STATUS_CHOICES = [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You added a model but where is the migration? You can create it using
./manage.py makemigrations
. The name generated automatically may or may not say 'added_contact_model'. If you end up with on with a name like "0004_auto_" please rename it to be more descriptive.I am puzzled by the failing tests in this PR. Hopefully adding a migration file will fix - or at least give us a more understandable error.