GithubHelp home page GithubHelp logo

squadran2003 / pug-or-ugh-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 23.77 MB

Paw left or right in this app to help potential pet owners find the dog of their dreams!

License: MIT License

Python 33.67% CSS 36.97% JavaScript 28.12% HTML 1.24%

pug-or-ugh-api's Introduction

Pug or Ugh

Requirements

Create the models, serializers, and views to power the provided Angular application. You can check through the supplied JavaScript to see what resources should be available or check below. You are allowed to change, extend, and improve the JavaScript if desired, but the final result must still meet all of the required features/abilities.

You've been provided with HTML and CSS for a basic, mobile-friendly design. You've also been provided with a starter Django project and application, a serializer and views for authentication, and a bit more.

Starting

Create a virtualenv and install the project requirements, which are listed in requirements.txt. The easiest way to do this is with pip install -r requirements.txt while your virtualenv is activated.

If you need to import dogs, a data_import script has been provided but it expects a DogSerializer and Dog model as outlined below to function properly.

Models

The following models and associated field names should be present as they will be expected by the JavaScript application.

  • Dog - This model represents a dog in the app.

    Fields:

    • name
    • image_filename
    • breed
    • age, integer for months
    • gender, "m" for male, "f" for female, "u" for unknown
    • size, "s" for small, "m" for medium, "l" for large, "xl" for extra large, "u" for unknown
  • UserDog - This model represents a link between a user an a dog

    Fields:

    • user
    • dog
    • status, "l" for liked, "d" for disliked
  • UserPref - This model contains the user's preferences

    Fields:

    • user
    • age, "b" for baby, "y" for young, "a" for adult, "s" for senior
    • gender, "m" for male, "f" for female
    • size, "s" for small, "m" for medium, "l" for large, "xl" for extra large

    age, gender, and size can contain multiple, comma-separated values

Serializers

You'll need to provide serializers for both the Dog and UserPref models. Each of them should reveal all of the fields with one exception: the UserPref serializer doesn't need to reveal the user.

Routes

The following routes are expected by the JavaScript application.

  • To get the next liked/disliked/undecided dog

    • /api/dog/<pk>/liked/next/
    • /api/dog/<pk>/disliked/next/
    • /api/dog/<pk>/undecided/next/
  • To change the dog's status

    • /api/dog/<pk>/liked/
    • /api/dog/<pk>/disliked/
    • /api/dog/<pk>/undecided/
  • To change or set user preferences

    • /api/user/preferences/

Tests

  • To run tests
    • coverage run --source=pugorugh/ manage.py test

Test report

  • Test report
    • coverage report -m

pug-or-ugh-api's People

Contributors

squadran2003 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.