add-model
/add-model
Dodaje model Django wraz z migracją, panelem admina, formularzem, widokami, szablonami i testami.
- Autor
- steamfield ↗
- Repozytorium
- stacks ↗
- Licencja
- Apache-2.0
- Ostatnia zmiana repozytorium
- 08.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 08.11.2026, bez odwołań do wycofanych modeli i API.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
Co robi i kiedy
Dodaje model Django wraz z migracją, panelem admina, formularzem, widokami, szablonami i testami.
Oryginalny opis (EN)
Add a Django model (in an existing app or a new one) with its migration, admin, form, views, templates and tests. Use when the user asks for a new kind of record, a new page that lists or edits records, or a new app.
Jak działa
SKILL.md bez nagłówków drugiego poziomu · 15 linii, 233 słów
Podgląd SKILL.md
---
name: add-model
description: Add a Django model (in an existing app or a new one) with its migration, admin, form, views, templates and tests. Use when the user asks for a new kind of record, a new page that lists or edits records, or a new app.
---
# Add a model
`notes/` is the model to copy: `models.py`, `admin.py`, `forms.py`, `views.py`, `urls.py`, `templates/notes/index.html`, `test_forms.py` and `tests/test_notes.py`. Read them first.
1. New app only: `uv run python manage.py startapp <app>`, then delete the generated `tests.py` and `views.py` stubs you won't use, add `"<app>"` to `INSTALLED_APPS` in `config/settings.py`, and include `<app>.urls` in `config/urls.py`. Add the app to the `paths:` list in `.claude/rules/django.md` and to `known-first-party` in `pyproject.toml`.
2. Write the model: fields, `class Meta` with an `ordering` that ends in a unique field, then `__str__`. A link to users is `models.ForeignKey(settings.AUTH_USER_MODEL, ...)`.
3. `make makemigrations`, read the generated file, then `make check-migrations`. Never write the migration by hand.
4. Register it in the app's `admin.py` with `list_display` and `search_fields`.
5. A `ModelForm[<Model>]` in `forms.py` listing `fields` explicitly; extra rules go in `clean_<field>` or `clean`.
6. A view per page in `views.py` that follows `notes.views.index`: allowed methods declared, redirect after a successful POST, bound form re-rendered on errors, querysets sliced and using `select_related`/`prefetch_related` for relations the template reads. Add its `path()` with a name and an `app_name` namespace.
7. Templates under `<app>/templates/<app>/`, extending `base.html`, with `{% csrf_token %}` in every POST form.
8. Tests: form rules beside the code (`<app>/test_forms.py`), and pages through the test client in `tests/test_<app>.py` with `pytestmark = pytest.mark.django_db`: list, create and redirect, each validation error, CSRF, and the admin changelist.
9. `make format`, then `make lint typecheck coverage check-migrations`.
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · steamfield/stacks | 86 | Apache-2.0 |
| giselles-ai/giselle | 100 | Apache-2.0 |
Migawka bazy z 13.11.2026 · wersja paczki 7a14eb3aacb6 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 86add-resource
Dodaje zasób REST do API Django REST Framework: model, migrację, admina, serializer, widoki, trasy i testy. - 100django-expert
Wspiera rozwój aplikacji webowych w Django z ORM, panelem admina i uwierzytelnianiem oraz Django REST Framework i architekturą projektu. - 100django-dev
Prowadzi przez zakładanie projektu Django, modele, formularze i konfigurację ustawień z Dynaconf, według wzorca jeden plik na model i spójnego nazewnictwa. - 100django
Wspiera budowę pełnych aplikacji webowych w Django: modele, widoki, szablony, ORM i panel admina, także w pytaniach o Django REST Framework, migracje i Channels. - 100django
Pomaga zakładać projekty Django i pisać modele, widoki, adresy URL i admin, dodawać REST API w Django REST framework, uruchamiać migracje, konfigurować produkcję i pisać testy. - 100django-developer
Pomaga budować aplikacje webowe i REST API w Django 4+ oraz unowocześniać istniejące projekty z widokami async i wzorcami enterprise.