diff --git a/README.md b/README.md index d59dcbe..4055da1 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ pip install graphene-django-cruddals ## 👩‍đŸ’ģ Usage -To use it, simply create a new class that inherits "`CruddalsModel`" +To use it, simply create a new class that inherits "`DjangoModelCruddals`" Suppose we have the following models. ```python @@ -72,7 +72,7 @@ class Choice(models.Model): Then we can create a complete CRUD+DALS for the models `Question` with the following code ```python -class CruddalsQuestion(CruddalsModel): +class CruddalsQuestion(DjangoModelCruddals): class Meta: model = Question ``` diff --git a/docs/docs/GET-STARTED/Quick-Start.md b/docs/docs/GET-STARTED/Quick-Start.md index d79a364..bd3c8ac 100644 --- a/docs/docs/GET-STARTED/Quick-Start.md +++ b/docs/docs/GET-STARTED/Quick-Start.md @@ -8,13 +8,62 @@ Hey there! Ready to start your project with graphene_django_cruddals? Awesome! I 1. Open up your favorite terminal. 2. Copy and paste the following command: -`pip install graphene_django_cruddals` + `pip install graphene_django_cruddals` ***Everything is ready!*** -## Setup +## Basic usage -Once you've installed the package, you'll be ready to start! You **don't need to worry** about any additional configurations. -Want to see it in action? Head over to the [Basic Usage](../GUIDE-TUTORIALS/Basic-Usage.md) section to experience its first usage 🚀. +To use it, simply create a new class that inherits "`DjangoModelCruddals`" +Suppose we have the following model. + +```python + class Restaurant(models.Model): + name = models.CharField(max_length=100) + slug = models.SlugField(max_length=100) +``` + +Then we can create a complete CRUD+DALS with the following code + +```python +class CruddalsRestaurant(DjangoModelCruddals): + class Meta: + model = Restaurant +``` + +Now you can use the `schema` that was generated for you + +```python +schema = CruddalsRestaurant.Schema +``` + +or use in your root `Query` and `Mutation` + +```python +class Query( + # ... your others queries + CruddalsRestaurant.Query, + graphene.ObjectType, +): + pass + + +class Mutation( + # ... your others mutations + CruddalsRestaurant.Mutation, + graphene.ObjectType, +): + pass + + +schema = graphene.Schema( query=Query, mutation=Mutation, ) +``` + +and this is it, now you can go to Graphiql or your favorite graphql client and see the new queries and mutations that graphene django cruddals made for you + +## Not working? + +1. Don't forget to set the `graphene_django` in your project +2. Don't forget to set the url for the graphql view in your project diff --git a/docs/docs/GUIDE-TUTORIALS/Basic-Usage.md b/docs/docs/GUIDE-TUTORIALS/Basic-Usage.md index 2892ae0..22546bc 100644 --- a/docs/docs/GUIDE-TUTORIALS/Basic-Usage.md +++ b/docs/docs/GUIDE-TUTORIALS/Basic-Usage.md @@ -1,28 +1,18 @@ ## 💡 Basic usage -To use it, simply create a new class that inherits "`CruddalsModel`" +To use it, simply create a new class that inherits "`DjangoModelCruddals`" Suppose we have the following model. ```python class Restaurant(models.Model): - name = models.CharField( - max_length=100, - help_text='The name of the restaurant' - ) - slug = models.SlugField( - help_text='The slug of the restaurant', - blank=True, - null=True, - unique=True, - editable=False, - max_length=100 - ) + name = models.CharField(max_length=100) + slug = models.SlugField(max_length=100) ``` Then we can create a complete CRUD+DALS with the following code ```python -class CruddalsRestaurant(CruddalsModel): +class CruddalsRestaurant(DjangoModelCruddals): class Meta: model = Restaurant ``` diff --git a/docs/docs/index.md b/docs/docs/index.md index be9d7bb..a5d1e3e 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -7,7 +7,7 @@ graphene-django-cruddals is a **library** for [Django] that extends [Graphene-dj First time using graphene-django-cruddals? We suggest starting with the [Quick-Start] to quickly set up your development environment and begin using the library in your project. Additionally, we recommend exploring the main documentation for [Graphene-django] to familiarize yourself with the basic utilities it offers. -[Quick-Start]:/GET%20STARTED/Quick-Start/ +[Quick-Start]:GET-STARTED/Quick-Start.md [Graphene-django]:https://docs.graphene-python.org/projects/django/en/latest/# [Django]: https://www.djangoproject.com/ diff --git a/docs/drafts/Quick-start.md b/docs/drafts/Quick-start.md index cb6008a..31928a7 100644 --- a/docs/drafts/Quick-start.md +++ b/docs/drafts/Quick-start.md @@ -9,7 +9,7 @@ For installing graphene_django_cruddals, just run this command in your shell ## ℹī¸ Basic usage -To use it, simply create a new class that inherits "`CruddalsModel`" +To use it, simply create a new class that inherits "`DjangoModelCruddals`" Suppose we have the following model. ```python @@ -31,7 +31,7 @@ Suppose we have the following model. Then we can create a complete CRUD+DALS with the following code ```python -class CruddalsRestaurant(CruddalsModel): +class CruddalsRestaurant(DjangoModelCruddals): class Meta: model = Restaurant ``` diff --git a/docs/drafts/step-by-step-installation.md b/docs/drafts/step-by-step-installation.md index a352241..6ccfa47 100644 --- a/docs/drafts/step-by-step-installation.md +++ b/docs/drafts/step-by-step-installation.md @@ -10,13 +10,13 @@ To install Graphene Django CRUDDALS, follow these steps: Install Graphene Django CRUDDALS with the virtual environment activated and in the project folder `pip install graphene-django-cruddals` -In the schema.py file of the app, replace all content, import the CruddalsModel class, and create a class that inherits from it +In the schema.py file of the app, replace all content, import the DjangoModelCruddals class, and create a class that inherits from it ```python - from graphene_django_cruddals import CruddalsModel + from graphene_django_cruddals import DjangoModelCruddals from .models import MyModel - class CruddalsMyModel(CruddalsModel): + class CruddalsMyModel(DjangoModelCruddals): class Meta: model = MyModel ```