dformkit


Namedformkit JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryA Django library for generating dynamic forms, views, and templates.
upload_time2025-01-12 21:55:26
maintainerNone
docs_urlNone
authorAbdulrahman Radan
requires_python>=3.6
licenseMIT
keywords django dynamic forms django forms form generation web development dynamic templates dformkit pip install dformkit dformkit install
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DFormKit

**DFormKit** is a Python library designed to help Django developers **dynamically generate forms**, manage views, and streamline template creation based on Django models.

---

## Why DFormKit?

This command-line wizard lets you **dynamically generate forms, templates, views, and URL patterns** for your Django models straight from your Terminal. It works seamlessly on Windows, Mac, and Linux, so you can use it on any platform.

While other tools make you wade through a swamp of settings and configurations, **DFormKit** keeps it simple. Just specify your app and model, and voilà! It’ll take you on a smooth ride to creating dynamic forms, no complex options needed—just fun coding! 🔥

---

## Features

- **Dynamic Form Generation:** Automatically generate forms from Django models.
- **Template Creation:** Create HTML templates for forms.
- **View Integration:** Add view functions and URL patterns dynamically.
- **Customizable Templates:** Supports integrating styling frameworks like Tailwind CSS.

---

## 🛠️ Installation

1. Install the library using `pip`:

   ```bash
   pip install dformkit
   ```

2. Add `'dformkit'` to `INSTALLED_APPS` in your Django project's `settings.py` file:

   ```python
   INSTALLED_APPS = [
       ...,
       'dformkit',
   ]
   ```

   - image showing the addition of `'dformkit'` to `INSTALLED_APPS` in `settings.py`.

## ![settings](https://raw.githubusercontent.com/abdulrahmanRadan/DFormKit/main/images/installed_app.png)

## 📈 Upgrade

Stay in the loop with the latest features on GitHub! To upgrade your **DFormKit** tool, simply run:

```bash
pip install --upgrade dformkit
```

Then you’re all set to keep generating dynamic forms from your Terminal! 🥳

---

## 🦸 Quick Start

Getting started with **DFormKit** is a piece of cake! Just use the following command style:

```bash
python manage.py dformkit myapp Person
```

**Note:**

- Replace `myapp` with your Django app name.
- Replace `Person` with your model name.

If you don’t specify additional options, it’ll generate a dynamic form for the model and save it in `forms.py`. Easy-peasy!

---

## 👨‍💻 Usage

### Arguments

| Argument | Description                                                     |
| -------- | --------------------------------------------------------------- |
| `app`    | The name of your Django app. This argument is **[Required]**.   |
| `model`  | The name of your Django model. This argument is **[Required]**. |

### Options

| Option           | Description                                                              |
| ---------------- | ------------------------------------------------------------------------ |
| `-page` or `--p` | Generate an HTML template for the form.                                  |
| `-view` or `--v` | Add a view function to `views.py` and a URL pattern to `urls.py`.        |
| `--pv` or `--vp` | Combine all options: generate the form, template, view, and URL pattern. |

---

## Examples

### 1. Generate a Form Only

```bash
python manage.py dformkit myapp Person
```

- **What it does:** Generates a dynamic form for the `Person` model in the `myapp` application.
- **Output:** The form is saved in `forms.py`.

---

### 2. Generate a Form and Template

```bash
python manage.py dformkit myapp Person -page
```

or

```bash
python manage.py dformkit myapp Person --p
```

- **What it does:** Generates the form and an HTML template for it.
- **Output:** The form is saved in `forms.py`, and the template is saved in the `templates` folder.

- This is the code generated with this command in templates/[formname]\_form.html

## ![htmlfile](https://raw.githubusercontent.com/abdulrahmanRadan/DFormKit/main/images/htmlform.png)

---

### 3. Generate a Form, View, and URL Pattern

```bash
python manage.py dformkit myapp Person -view
```

or

```bash
python manage.py dformkit myapp Person --v
```

- **What it does:** Generates the form, adds a view function to `views.py`, and adds a URL pattern to `urls.py`.
- **Output:** The form, view, and URL pattern are created.

![urlviewfile](https://raw.githubusercontent.com/abdulrahmanRadan/DFormKit/main/images/urls.py.png)
![urlviewfile](https://raw.githubusercontent.com/abdulrahmanRadan/DFormKit/main/images/views-py.png)

---

### 4. Combine All Options

```bash
python manage.py dformkit myapp Person --pv
```

or

```bash
python manage.py dformkit myapp Person --vp
```

- **What it does:** Combines all the above steps into one command.
- **Output:** The form, template, view, and URL pattern are generated.

- this is the new form code in forms.py when use this command

## ![image](https://raw.githubusercontent.com/abdulrahmanRadan/DFormKit/main/images/forms.py.png)

## 🧰 Additional Features

### Using Named Arguments

You can use named arguments for more flexibility. For example:

```bash
python manage.py dformkit -app=myapp -model=Person -view
```

or

```bash
python manage.py dformkit -app=myapp -model=Person --pv
```

- **What it does:** Works the same as positional arguments but provides a more explicit way to specify the app and model.

---

### Overwriting Existing Forms

If the form already exists in `forms.py`, the library will warn you before overwriting it. You can choose to proceed or skip.

---

### Customizing Templates

The generated templates are fully customizable. You can integrate styling frameworks like **Tailwind CSS** or **Bootstrap** by modifying the generated HTML files.

---

## Testing the Library

You can run unit tests using **pytest**:

```bash
pytest
```

---

## Contributing

We welcome contributions! Follow these steps:

1. Fork the repository.
2. Create a new branch for your feature or fix.
3. Write tests if applicable.
4. Submit a **Pull Request** with details about your changes.

---

## ❓ Frequently Asked Questions (FAQ)

### 1. What happens if the form already exists in `forms.py`?

- If the form already exists, the library will warn you before overwriting it. You can choose to proceed or skip.

### 2. Can I customize the generated templates?

- Yes, the generated templates are fully customizable. You can integrate styling frameworks like Tailwind CSS or Bootstrap.

### 3. How do I add validation to the form?

- Validation is automatically handled based on the constraints defined in your Django model (e.g., `max_length`, `null`, `blank`, etc.).

---

## 🚀 Conclusion

**DFormKit** simplifies the process of generating forms, templates, views, and URL patterns in Django. By following the steps above, you can quickly set up dynamic forms for your models and streamline your development workflow.

---

## 📜 License

This project is licensed under the [MIT License](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dformkit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "django, dynamic forms, django forms, form generation, web development, dynamic templates, dformkit, pip install dformkit, dformkit install",
    "author": "Abdulrahman Radan",
    "author_email": "abdulrahmanraadan@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/36/3b/c974668f4138bff10fc58aecb13dc081fac09f0f1aacccf271db607201bf/dformkit-0.1.2.tar.gz",
    "platform": "Linux",
    "description": "# DFormKit\r\n\r\n**DFormKit** is a Python library designed to help Django developers **dynamically generate forms**, manage views, and streamline template creation based on Django models.\r\n\r\n---\r\n\r\n## Why DFormKit?\r\n\r\nThis command-line wizard lets you **dynamically generate forms, templates, views, and URL patterns** for your Django models straight from your Terminal. It works seamlessly on Windows, Mac, and Linux, so you can use it on any platform.\r\n\r\nWhile other tools make you wade through a swamp of settings and configurations, **DFormKit** keeps it simple. Just specify your app and model, and voil\u00e0! It\u2019ll take you on a smooth ride to creating dynamic forms, no complex options needed\u2014just fun coding! \ud83d\udd25\r\n\r\n---\r\n\r\n## Features\r\n\r\n- **Dynamic Form Generation:** Automatically generate forms from Django models.\r\n- **Template Creation:** Create HTML templates for forms.\r\n- **View Integration:** Add view functions and URL patterns dynamically.\r\n- **Customizable Templates:** Supports integrating styling frameworks like Tailwind CSS.\r\n\r\n---\r\n\r\n## \ud83d\udee0\ufe0f Installation\r\n\r\n1. Install the library using `pip`:\r\n\r\n   ```bash\r\n   pip install dformkit\r\n   ```\r\n\r\n2. Add `'dformkit'` to `INSTALLED_APPS` in your Django project's `settings.py` file:\r\n\r\n   ```python\r\n   INSTALLED_APPS = [\r\n       ...,\r\n       'dformkit',\r\n   ]\r\n   ```\r\n\r\n   - image showing the addition of `'dformkit'` to `INSTALLED_APPS` in `settings.py`.\r\n\r\n## ![settings](https://raw.githubusercontent.com/abdulrahmanRadan/DFormKit/main/images/installed_app.png)\r\n\r\n## \ud83d\udcc8 Upgrade\r\n\r\nStay in the loop with the latest features on GitHub! To upgrade your **DFormKit** tool, simply run:\r\n\r\n```bash\r\npip install --upgrade dformkit\r\n```\r\n\r\nThen you\u2019re all set to keep generating dynamic forms from your Terminal! \ud83e\udd73\r\n\r\n---\r\n\r\n## \ud83e\uddb8 Quick Start\r\n\r\nGetting started with **DFormKit** is a piece of cake! Just use the following command style:\r\n\r\n```bash\r\npython manage.py dformkit myapp Person\r\n```\r\n\r\n**Note:**\r\n\r\n- Replace `myapp` with your Django app name.\r\n- Replace `Person` with your model name.\r\n\r\nIf you don\u2019t specify additional options, it\u2019ll generate a dynamic form for the model and save it in `forms.py`. Easy-peasy!\r\n\r\n---\r\n\r\n## \ud83d\udc68\u200d\ud83d\udcbb Usage\r\n\r\n### Arguments\r\n\r\n| Argument | Description                                                     |\r\n| -------- | --------------------------------------------------------------- |\r\n| `app`    | The name of your Django app. This argument is **[Required]**.   |\r\n| `model`  | The name of your Django model. This argument is **[Required]**. |\r\n\r\n### Options\r\n\r\n| Option           | Description                                                              |\r\n| ---------------- | ------------------------------------------------------------------------ |\r\n| `-page` or `--p` | Generate an HTML template for the form.                                  |\r\n| `-view` or `--v` | Add a view function to `views.py` and a URL pattern to `urls.py`.        |\r\n| `--pv` or `--vp` | Combine all options: generate the form, template, view, and URL pattern. |\r\n\r\n---\r\n\r\n## Examples\r\n\r\n### 1. Generate a Form Only\r\n\r\n```bash\r\npython manage.py dformkit myapp Person\r\n```\r\n\r\n- **What it does:** Generates a dynamic form for the `Person` model in the `myapp` application.\r\n- **Output:** The form is saved in `forms.py`.\r\n\r\n---\r\n\r\n### 2. Generate a Form and Template\r\n\r\n```bash\r\npython manage.py dformkit myapp Person -page\r\n```\r\n\r\nor\r\n\r\n```bash\r\npython manage.py dformkit myapp Person --p\r\n```\r\n\r\n- **What it does:** Generates the form and an HTML template for it.\r\n- **Output:** The form is saved in `forms.py`, and the template is saved in the `templates` folder.\r\n\r\n- This is the code generated with this command in templates/[formname]\\_form.html\r\n\r\n## ![htmlfile](https://raw.githubusercontent.com/abdulrahmanRadan/DFormKit/main/images/htmlform.png)\r\n\r\n---\r\n\r\n### 3. Generate a Form, View, and URL Pattern\r\n\r\n```bash\r\npython manage.py dformkit myapp Person -view\r\n```\r\n\r\nor\r\n\r\n```bash\r\npython manage.py dformkit myapp Person --v\r\n```\r\n\r\n- **What it does:** Generates the form, adds a view function to `views.py`, and adds a URL pattern to `urls.py`.\r\n- **Output:** The form, view, and URL pattern are created.\r\n\r\n![urlviewfile](https://raw.githubusercontent.com/abdulrahmanRadan/DFormKit/main/images/urls.py.png)\r\n![urlviewfile](https://raw.githubusercontent.com/abdulrahmanRadan/DFormKit/main/images/views-py.png)\r\n\r\n---\r\n\r\n### 4. Combine All Options\r\n\r\n```bash\r\npython manage.py dformkit myapp Person --pv\r\n```\r\n\r\nor\r\n\r\n```bash\r\npython manage.py dformkit myapp Person --vp\r\n```\r\n\r\n- **What it does:** Combines all the above steps into one command.\r\n- **Output:** The form, template, view, and URL pattern are generated.\r\n\r\n- this is the new form code in forms.py when use this command\r\n\r\n## ![image](https://raw.githubusercontent.com/abdulrahmanRadan/DFormKit/main/images/forms.py.png)\r\n\r\n## \ud83e\uddf0 Additional Features\r\n\r\n### Using Named Arguments\r\n\r\nYou can use named arguments for more flexibility. For example:\r\n\r\n```bash\r\npython manage.py dformkit -app=myapp -model=Person -view\r\n```\r\n\r\nor\r\n\r\n```bash\r\npython manage.py dformkit -app=myapp -model=Person --pv\r\n```\r\n\r\n- **What it does:** Works the same as positional arguments but provides a more explicit way to specify the app and model.\r\n\r\n---\r\n\r\n### Overwriting Existing Forms\r\n\r\nIf the form already exists in `forms.py`, the library will warn you before overwriting it. You can choose to proceed or skip.\r\n\r\n---\r\n\r\n### Customizing Templates\r\n\r\nThe generated templates are fully customizable. You can integrate styling frameworks like **Tailwind CSS** or **Bootstrap** by modifying the generated HTML files.\r\n\r\n---\r\n\r\n## Testing the Library\r\n\r\nYou can run unit tests using **pytest**:\r\n\r\n```bash\r\npytest\r\n```\r\n\r\n---\r\n\r\n## Contributing\r\n\r\nWe welcome contributions! Follow these steps:\r\n\r\n1. Fork the repository.\r\n2. Create a new branch for your feature or fix.\r\n3. Write tests if applicable.\r\n4. Submit a **Pull Request** with details about your changes.\r\n\r\n---\r\n\r\n## \u2753 Frequently Asked Questions (FAQ)\r\n\r\n### 1. What happens if the form already exists in `forms.py`?\r\n\r\n- If the form already exists, the library will warn you before overwriting it. You can choose to proceed or skip.\r\n\r\n### 2. Can I customize the generated templates?\r\n\r\n- Yes, the generated templates are fully customizable. You can integrate styling frameworks like Tailwind CSS or Bootstrap.\r\n\r\n### 3. How do I add validation to the form?\r\n\r\n- Validation is automatically handled based on the constraints defined in your Django model (e.g., `max_length`, `null`, `blank`, etc.).\r\n\r\n---\r\n\r\n## \ud83d\ude80 Conclusion\r\n\r\n**DFormKit** simplifies the process of generating forms, templates, views, and URL patterns in Django. By following the steps above, you can quickly set up dynamic forms for your models and streamline your development workflow.\r\n\r\n---\r\n\r\n## \ud83d\udcdc License\r\n\r\nThis project is licensed under the [MIT License](LICENSE).\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Django library for generating dynamic forms, views, and templates.",
    "version": "0.1.2",
    "project_urls": {
        "Author": "https://github.com/abdulrahmanRadan",
        "Bug Tracker": "https://github.com/abdulrahmanRadan/dformkit/issues",
        "Documentation": "https://github.com/abdulrahmanRadan/dformkit#readme",
        "Homepage": "https://github.com/abdulrahmanRadan/dformkit",
        "Source Code": "https://github.com/abdulrahmanRadan/dformkit"
    },
    "split_keywords": [
        "django",
        " dynamic forms",
        " django forms",
        " form generation",
        " web development",
        " dynamic templates",
        " dformkit",
        " pip install dformkit",
        " dformkit install"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "01069fa902fcb5d7164b8b380f4d44e2e07faf48a2abdb00f6ebc68c46fe89e0",
                "md5": "9971cb48fea30aaa9a42ed38cdd61e0b",
                "sha256": "0ef8f00d1ebbc43404476a3df7f1b53c7ed31481bc131fef38bccd81127f3db6"
            },
            "downloads": -1,
            "filename": "dformkit-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9971cb48fea30aaa9a42ed38cdd61e0b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 14159,
            "upload_time": "2025-01-12T21:55:24",
            "upload_time_iso_8601": "2025-01-12T21:55:24.588242Z",
            "url": "https://files.pythonhosted.org/packages/01/06/9fa902fcb5d7164b8b380f4d44e2e07faf48a2abdb00f6ebc68c46fe89e0/dformkit-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "363bc974668f4138bff10fc58aecb13dc081fac09f0f1aacccf271db607201bf",
                "md5": "3756a549f5833a4bb514bff836328ee0",
                "sha256": "5dfc172feb64b1686f7fd0893345f6261557c1e7afa028e2a58b83e8942aaf2c"
            },
            "downloads": -1,
            "filename": "dformkit-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "3756a549f5833a4bb514bff836328ee0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 15053,
            "upload_time": "2025-01-12T21:55:26",
            "upload_time_iso_8601": "2025-01-12T21:55:26.027087Z",
            "url": "https://files.pythonhosted.org/packages/36/3b/c974668f4138bff10fc58aecb13dc081fac09f0f1aacccf271db607201bf/dformkit-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-12 21:55:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "abdulrahmanRadan",
    "github_project": "dformkit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "dformkit"
}
        
Elapsed time: 0.49070s