I am trying to save a contact form, but i am not using the django form but instead the input field. I am getting the name, email address and message body from the html templates using input field like this <input type=”text” id=”name”> but the form doesn’t get any data from…
Tag: django
How to delete data from database with a button using only DJANGO python, java script, and HTML?
I am working on a django project where my database gets populated from a post call, and for quality of life, I want to be able to clear ALL of the data from the database at the click of a button. If it’s possible, I’d like to only use python, javascript, and HTML. I’ve done some searching on…
Django query for column value search?
What is the Django query for this? DB data – I only need record that contain “1.2.3” values not like – (“Cat 1.2.3” or “1.2.3-XY2” or any such value). And pattern “1.2.3” can be anywhere in column where column value can have comma separated values to…
Rendering highest integer value from three models instances in django
I have three models which are related all to one model. I am rendering MyParentModel in DetailView (CBV) and passing related models as a context to render individual models ‘ranking’ field on the same template. Now I need to render same ‘ranking’ on MyParentModel ListView, but I only w…
Div Columns not aligning correctly in Django/Python
I’m following along a tutorial and, unfortunately, his code editor automatically indented everything when he copied/pasted a new <div> (Sigh) (In the second pic I cut off the top where it has LOGO in the top right on accident in the screenshot) The problem is i Room.html This is what it currently …
How do you run a function to compare two date by month?
I’m trying to run a function to compare today’s month with the month input by a user. The dates will be input by the user as ‘YYYY-MM-DD’. This is what I have so far: But get the following error: fromisoformat: argument must be str So I tried using the following function instead with s…
Django Error: ValueError: Field ‘id’ expected a number but got ‘Нет’
I was adding a new model, but had the error ValueError: Field ‘id’ expected a number but got ‘Нет’. After that I deleted a new model, but error don’t disappear. I tried to change models.py, admin.py, form.py and I even deleted fully models.py, but it didn’t change anything.…
Is it better to use JsonField or multiple model fields for a Django Model?
For example, Or Assume that I have a limited (max 5) number of descriptions. Which approach is better and would be considered as good practice? Answer I am generally in favour of multiple models rather than using JSON, though there is still a time and a place for the JSON field. You have a number of descripti…
Django – CreateView specifying a form to use from forms.py
I’m trying to use a form I have defined in forms.py within my CreateView, as I have css classes and field labels I want to apply. Documentation states declaring a form_class field within your CreateView, but trying to set it as my ModelForm gives me the error TypeError ‘AssessmentForm’ objec…
NoReverseMatch as consequence of a form action
This is my urls.py: This is my views.py: This is what I want to render (edit.html): When I want to send the form above with the current action it gives me: NoReverseMatch at /wiki/CSS/edit but when I remove action it doesn’t display any error. Could you please tell me why this happens? Answer reverse me…