-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(articles errors):Refactor articles and heroku deployment
- adds user profile details to the return responses - works a robust slug implementation - edit model to allow unique slugs - Refactored code to be more Django - added individual migration files in procfile - streamlined the requirements.txt file - removed unused functions [Delivers #162694397]
- Loading branch information
Showing
20 changed files
with
228 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
from django.db import models | ||
from authors.apps.authentication.models import User | ||
from authors.apps.profiles.models import Profile | ||
|
||
# Create your models here. | ||
|
||
|
||
class Articles(models.Model): | ||
""" Model for all articles """ | ||
slug = models.SlugField(max_length=250, default='non') | ||
title = models.CharField(max_length=50, default='non') | ||
description = models.CharField(max_length=250, default='non') | ||
body = models.CharField(max_length=550, default='non') | ||
tagList = models.CharField(max_length=50, | ||
default='non') # ["dragons", "training"], | ||
slug = models.SlugField(unique=True, max_length=250) | ||
title = models.CharField(max_length=250) | ||
description = models.CharField(max_length=350) | ||
body = models.TextField() | ||
tagList = models.CharField(max_length=200) | ||
createdAt = models.DateTimeField(auto_now_add=True) | ||
updatedAt = models.DateTimeField(auto_now=True) | ||
favorited = models.BooleanField(default=False) | ||
favoritesCount = models.IntegerField(default=0) | ||
readtime = models.IntegerField(default=0) | ||
author = models.ForeignKey(User, default=0, on_delete=models.CASCADE) | ||
|
||
def __str__(self): | ||
""" String representation of db object """ | ||
return ' {}: {}'.format(self.id, self.slug) | ||
author = models.ForeignKey(Profile, on_delete=models.CASCADE) | ||
|
||
class Meta: | ||
ordering = ["-createdAt", "-updatedAt"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.