Welcome to falco Discussions! #9
Replies: 3 comments 3 replies
-
Hello, I am currently testing the tool Falco/CRUD for my model. I find the approach very helpful and can imagine using it in my projects. One point I don’t understand, however, is why the HTML files are overwritten. When I generate a model with the command "install-crud-utils", the files views.py and urls.py are amended accordingly. However, the HTML files are overwritten for each model. This is also documented: "Unlike the Python code, the generated HTML templates will overwrite any existing ones." From my perspective, it would be helpful to have a specific output directory for the HTML files. This way, the views and urls would not need to be edited again. Why is the current solution set up this way? What might I have misunderstood? Thanks for the feedback. |
Beta Was this translation helpful? Give feedback.
-
Hello Tobi, Thank you for your prompt response, and I apologize for not being clear earlier. I am not a software developer, so perhaps I misunderstood something in the guide! Here's an attempt to explain my idea better: 0. Project Setup
1. models.py class Word(TimeStampedModel):
class Sentence(TimeStampedModel):
class WordType(TimeStampedModel): 2. CRUD for Your Model
3. HTML Files
My Concern and Thoughts: Current Understanding: Assumption: Current Solution:
Afterwards, I manually adjust the views.py and urls.py so that the data can be accessed correctly. Example in views.py: def word_detail(request: HttpRequest, pk: int):
word = get_object_or_404(Word.objects, pk=pk)
return TemplateResponse(
request,
"card2brain/word/detail.html",
context={"word": word},
) urls.py: urlpatterns = [
path("word", views.word_index, name="word_index"),
path("word_create/", views.word_create, name="word_create"),
path("<int:pk>/word_detail/", views.word_detail, name="word_detail"),
path("<int:pk>/word_update/", views.word_update, name="word_update"),
path("<int:pk>/word_delete/", views.word_delete, name="word_delete"),
] Perhaps I have misunderstood something, as I am not a professional in this field. It would be helpful for me to be able to create the HTML files seamlessly in one go. Thank you for your support, Felix |
Beta Was this translation helpful? Give feedback.
-
Hello Tobi, |
Beta Was this translation helpful? Give feedback.
-
👋 Welcome!
We’re using Discussions as a place to connect with other members of our community. We hope that you:
build together 💪.
To get started, comment below with an introduction of yourself and tell us about what you do with this community.
Beta Was this translation helpful? Give feedback.
All reactions