Skip to content
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

#161966610 CRUD for Article #20

Closed
wants to merge 0 commits into from

Conversation

SnyderMbishai
Copy link
Contributor

What does this pull request do?

This PR implements the CRUD methods for articles.

Description of the tasks to be completed?

  • create article
    POST /api/articles/

  • get article
    GET /api/articles/<slug>

  • get articles
    GET /api/articles/

  • update articles
    PUT /api/articles/<slug>

  • delete articles
    DELETE /api/articles/<slug>

  • test the above functionalities

How should this be manually tested?

   $ git clone https://github.com/andela/ah-technocrats.git
   $ cd ah-technocrats
   $ git checkout ft-create-articles-161966610
   $ python3 -m venv venv
   $ source venv/bin/activate
   $ pip install -r requirements.txt
   $ python manage.py makemigrations
   $ python manage.py migrate
   $ python manage.py runserver

testing:

   $ python manage.py test

Screenshots:

Posting an article
image

Get all articles
image

Get a specic article using it's slug
image

Update an article
image

Delete article
image

Testsing
image
image

What are the relevant Pivotal Tracker Stories

#161966610

Checklist:

  • My code follows the style guidelines of this project
  • At least 2 people have reviewed my PR
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • My PR has one commit.

@SnyderMbishai SnyderMbishai added the WIP Work In Progress label Dec 11, 2018
# A primary key should be provided.
# An article should be edited by the person who created it only.
article = Article.objects.get(article_slug=slug)
if request.user.pk != article.author_id:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identical blocks of code found in 2 locations. Consider refactoring.

"""
try:
article = Article.objects.get(article_slug=slug)
if article:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identical blocks of code found in 2 locations. Consider refactoring.

@codeclimate
Copy link

codeclimate bot commented Dec 11, 2018

Code Climate has analyzed commit c9c785a and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 2

View more on Code Climate.

@SnyderMbishai SnyderMbishai deleted the ft-create-articles-161966610 branch December 11, 2018 16:00
@SnyderMbishai SnyderMbishai restored the ft-create-articles-161966610 branch December 11, 2018 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP Work In Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant