Skip to main content

BaseApp Follows

Project description

BaseApp Follows

Reusable app to enable User's follows on any model, features like like/dislike or any other follows type, customizable for project's needs.

Requirements:

- **baseapp-core** >= 0.2.3

Run pip install baseapp-follows And make sure to add the frozen version to your requirements/base.txt file

If you want to develop, install using this other guide.

How to use

Add baseapp_follows to your project's INSTALLED_APPS

Now make sure all models you'd like to get follows also inherits FollowableModel, like:

from baseapp_follows.models import FollowableModel

class User(models.Model, FollowableModel):

Also make sure your GraphQL object types extends FollowsInterface interface:

from baseapp_follows.graphql.object_types import FollowsInterface

class UserNode(DjangoObjectType):
    class Meta:
        interfaces = (relay.Node, FollowsInterface)

Expose FollowsMutations in your GraphQL/graphene endpoint, like:

from baseapp_follows.graphql.mutations import FollowsMutations

class Mutation(graphene.ObjectType, FollowsMutations):
    pass

schema = graphene.Schema(query=Query, mutation=Mutation)

This will expose followToggle mutation and add fields and connections to all your GraphqlQL Object Types using interface FollowsInterface.

Example:

    mutation FollowButtonMutation($input: FollowToggleInput!) {
        followToggle(input: $input) {
            follow {
                node {
                id
                }
            }
            target {
                id
                followersCount
                isFollowedByMe
            }
            actor {
                id
                followingCount
            }
        }
    }

How to develop

Clone the project inside your project's backend dir:

git clone git@github.com:silverlogic/baseapp-backend.git

And manually install the package:

pip install -e baseapp-backend/baseapp-follows

The -e flag will make it like any change you make in the cloned repo files will effect into the project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

baseapp-follows-0.0.1.tar.gz (10.2 kB view details)

Uploaded Source

File details

Details for the file baseapp-follows-0.0.1.tar.gz.

File metadata

  • Download URL: baseapp-follows-0.0.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for baseapp-follows-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e11089a66558990f49d188d87efc12f8ce63f6dd43f4c5678ac07effd9063b4a
MD5 48b3c323b32a2620194a060222a7e4a9
BLAKE2b-256 8c7da8c97c17f2abaf6eeafe6bc3a85e7522f4642d5264bf4ab3f47f505e5eae

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page