Contributing to django-to-rest
Thank you for your interest in contrubiting to this project. Please get involved and help to make the project better. The contributions can be in the form of ideas, development, documentations and testing in the form test scripts.
Code of Conduct¶
Check this link for code of conduct: Code of Conduct
Issues¶
- Ensure that you discuss the topic before raising an issue. Check Github discussions page for discussions.
- Ensure that the issues are properly explained
- Before raising an issue check if similar issue already exists in Github issues page
Development¶
To start developing:
- First create a fork
- Clone your fork
- It is recommended to have a virtual environment
- Install
django 4.0.5
,django-rest-framework 3.13.1
anddjango-filter 22.1
- Create new branch
- Start you development on the new branch...
- To test your changes in a django project install the project from your local machine using the command:
python3 -m pip install path-to-project's-directory
. For example, if the directorydjango-to-rest
is in~/project/
then the command would bepython3 -m pip install ~/project/django-to-rest/
- And then follow the Quickstart Guide for better understanding. Note that the project needs to be installed from the local machine and not from PyPi.
See GitHub's Fork a Repo Guide for more help.
Testing¶
Note
Apart from development, you can also contribute test scripts to cover the scenarios that are not covered yet to make the project better.
There are five apps in the tests
directory for testing different scenarios:
-
tests/test_basics
- To test generic scenarios
- Command to run test:
-
tests/test_basics_defaults
- To test generic scenarios with configuration in settings file
- For this app there is a dedicated settings file at
tests/tests/settings_test_basics_defaults.py
- Command to run test:
-
tests/test_many_to_many
- To test scenarios related to many-to-many relationship
- Command to run test:
-
tests/test_many_to_one
- To test scenarios related to many-to-one relationship
- Command to run test:
-
tests/test_one_to_one
- To test scenarios related to one-to-one relationship
- Command to run test:
Before running any test first install django-to-rest by executing below command at the root directory of the repository (where the setup.py resides). This will also install other packages required (that are mentioned in the Development
section):
$ python3 -m pip install ./
Whenever any change in code is made, uninstall django-to-rest:
$ python3 -m pip uninstall django-to-rest
And then install again to run the test on the updated code. Ensure that the test scripts are well commented so that one can understand about the scenario for which it is tested. Check existing scripts for example.
For creating any test one would need the view names for reversing urls. Check this page for how the view names are generated by the library.
Documentation¶
The documentation is made using Material for Mkdocs. All the files related to documentation is inside docs
directory. Just update the code and hit below command to preview:
$ mkdocs serve
Check Material for Mkdocs for more help.
Contribute and make pull request¶
All the contributions have to be made via a pull request. After you have cloned the forked repository, follow below steps:
- Go into the project's directory (that is
django-to-rest
) - Create a new branch using following command in the command line:
git branch new-branch-name
- Checkout to the new branch using following command in the command line:
git checkout new-branch-name
- Make the changes that you want to contribute
- Stage your changes using the following command in command line:
git command .
- Check the status using the command:
git status
- Commit your changes using the command:
git commit -m "commit message"
- Push your changes to the remote branch on GitHub by using the following command:
git push -u origin branch_name
- Open a pull request directed to our
master
branch
For tutorials on pull request check below links: