Giter VIP home page Giter VIP logo

assisted-django's Introduction

Assisted Django

PyPI version

A CLI Tool to generate content for all files in a django app directory including templates with the help of openai models

This script would generate the following files for you:

  • models.py
  • views.py
  • urls.py
  • admin.py
  • tests.py
  • forms.py
  • signals.py
  • HTML templates

Meant to be run after the startapp command

Installation

pip install assisted-django

Usage
  1. Make a django project and create a new app as usual
  2. Run python -m assisted_django in the same level as manage.py
  3. CLI will guide you through the rest of the process

Additional Notes

  • Set the OPENAI_API_KEY in your .env file
  • This script will overwrite the existing app directory files
  • The CLI will confirm with the full file path before taking any action
  • Write better briefs to get better results

Some More Context

  • We prefer class based generic views
  • We utilize django-crispy-forms with bootstrap4
  • Html templates utilize bootstrap4

assisted-django's People

Contributors

fauzaanu avatar

Watchers

Kostas Georgiou avatar  avatar  avatar

assisted-django's Issues

switch to tailwindcss

tailwindcss code generators are pretty good already, we could see a lot better and diverse ui if we switch to TW from BS

Better templates

  1. Creation of a base.html which comes in built already.

    1. Bootstrap4
    2. tailwindcss

While using tailwindcss simply use the cdn as developer can later handle the rest.

  1. Provide example responses for templates so that the explanation is minimal or doesn't come

ability to update just one file

each step is dependent on the contents from some other steps.

if the models are already written we can give option to exclude that file or to include only models file based on the rest.

some constrains to making this happen:

some of the generations depend on two files being present, for example Models and Views need to be present generate somefiles. in this case should prompt user to make sure they are filled

admin.py becoming views.py

sometimes admin.py still generates a views.py.

Solutions:

  • Improve the prompt
  • use regex to detect HTML templates mentioned and run again?
  • running again is extra cost for the user, so display this as a message

Better examples

  • Update examples with better code
  • make a collection of examples
  • randomize the example picked from the collection
  • different code could introduce randomness in the response when re-run again

Fix Diagram

diagram is no longer accurate:

  • tests
  • templates
  • signals

missing . . .

Some calls to OpenAI could be async

Initially, since every file depends on other files, this was not possible. But we now have some files that depend on just the model's content.

In this case, when models content is ready, we should fire all requests depending on that.

This will speed up the whole process.

Attempt to Change to a command line tool with arguments

Its not convenient to use the script, copy locations and so on.

The command line script could do a lot.

  • Scan the Django app directories and let the user pick a directory rather than us copying and pasting
  • using flags manage if the brief additionally needs improvement
  • Perhaps someone doesn't need signals or another component
  • make it a package, so things become easier.

Appdir templates

templates currently are not namespaced with the appdir

  • add instruction to name them with appname

Wagtail app generations

Wagtail has even less code to write in the general way things are set. Adding wagtail as a mode cant be that hard.. I think. ๐Ÿค”

Need to include a wagtail example for models.py

signals

Generate signals for models.

Access to models.py file contents

Adjust Project settings and URLs

Add an optional flag that updates the INSTALLED_APPS and URLs patterns to include the new apps pattern

Instead of modifying the existing stuff, we should add a += to the variable at the EOF

Serializers

Create Serializes based on models

Feed Serializes while creating URLs, so API routes are also created additionally.

Better Brief

rate the brief against some rules such as database design and relationships being clear or not and re-generate the brief if the details are not enough.

Bad briefs == comments left by gpt3 with instructions that are not commented despite the example response provided

base html template

inject a base html template with bootstrap headers. Mention that base.html exists into the template prompts.

html templates cleanup

html templates needs to be clean from andhtml and the text in between

Regex to detect > text ``` perheps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.