Questions tagged [django-forms]
Specific questions related to forms within the Django web framework.
20,121
questions
0
votes
0
answers
14
views
Adding the search button and filter button to a single button in Django
Here I am trying to activate two functions with one button.
How would it be to write the search button and filter system in a single function, as shown in the examples? I used the django filters ...
0
votes
0
answers
4
views
Django Select2 Line-height choices
I would like to make the line-height for the dropdown choices of this Select2 results smaller. (See image) I can't find what css to use. Looked in the Select2 package but could not find something that ...
-1
votes
0
answers
25
views
save method in django not saving data,field changes
i have tried all i think i should but my django model is not updating. The save() method is not working even though there seem not to be an error. What am i doing wrong? or what did i miss?
...
0
votes
1
answer
30
views
Display Django Form Fields depending on option selected using Javascript
I am working on a Django Project and I have the following html page which renders a form.
I do not know much of Javascript, and I think I am going wrong somewhere in the Javascript Function or ...
0
votes
0
answers
11
views
django-dynamic-formsets not working in one template - the same structure works in other template
I have this simple django template which only displays formset, allows user to add and remove instances of formset, and submittes the data by clicking the button. This templete is fine, it displays ...
0
votes
1
answer
32
views
django form.modelchoicefield get selected value
How to display the "PS1 Failure" instead of value "4" in html template ? with below code
form:
class FailureCodeForm(forms.ModelForm):
failure_name = forms.ModelChoiceField(...
0
votes
0
answers
12
views
Only the author of the comment can delete and edit?
I´m trying to create an if statement using django so only the one who wrote the comment can access the delete and edit icons. I tried different statements and I don´t understand why it won´t work.
I ...
0
votes
0
answers
27
views
Facing an issue to update an existing object in Django 4
I'm working with a Diagnostic tool, I'm trying to update an existing instance of the database, I'm rendering a group of data corresponding to the device which being repaired, I have a second section ...
0
votes
0
answers
26
views
How can I add a MultipleChoiceField field to ConfigForm (djconfig library)?
I have a form that I'm trying to add a MultipleChoiceField to.
class BasicConfigForm(ConfigForm):
site_name = forms.CharField(initial="Spirit", label=_("site name"))
...
1
vote
1
answer
13
views
Text input in list choice django form
I have two model in my project: Viaggio and Cliente. Viaggio has a Foreign Key of Cliente, so the basic structure is:
class Viaggio(models.Model):
nome = models.CharField(max_length=255, unique=...
0
votes
1
answer
40
views
Error 500 rom Djanjo when trying to send my form data in JavaScript to my Django Url
I am trying to build a ToDo List in Djanjo and I am having issues while trying to build the edit view functionality, below is my home.html file
<div class="col-md-7 col-lg-7" style="...
0
votes
0
answers
29
views
DJANGO-choicefield not appearing in website
views.py
def remark_proof_api(request, room_id, bills_slug):
submission_form = SubmissionForm()
try:
room = Room.objects.get(join_code=room_id)
room_bills = bills.objects.get(...
2
votes
0
answers
26
views
dropdown select showing up in views.py but not in the clean method in forms.py
I have a django template as follows
<div class="container-fluid lineitem_form_container">
<div class="inner_holder">
<h2>Add Line Item</h2>
...
0
votes
1
answer
24
views
Pre-populate FK relation with logged in user without dropdown in GET request
I would like to pre-populate fields with driver info into html page(more driver into needed) which he already filled during registration(as a normal user)
for example "username"
I am able to ...
0
votes
0
answers
39
views
Return many forms in one view - Django Project
I'm not advanced in Django yet, so please be understanding. I'm currently working on creating my portfolio app. The idea is to build something similar to https://track.toggl.com. I frequently use this ...
2
votes
2
answers
102
views
Django - While registering, registered data are not saved on database and so can't perform LogIn
I have been trying so hard to make an user registration and login using Django. I am using AbstractUser for this. Whenever, I enter the form fields, and click Signup the page is not getting redirected ...
0
votes
0
answers
41
views
Not getting the right fields in Django
I am trying to create a subscription feature in my Django site where a user enters his name and email and clicks the 'Subscribe' button. I have written this code in the subscribe.html form but it ...
0
votes
1
answer
50
views
My Django models are saved, but the ImageField is not
I am using two classes to abstract the user in my system: the Django default User and my class Documentador.
I treat them both as one on the interface side, and for creating a User and Documentador ...
-1
votes
0
answers
31
views
Django ORM calculate score and win from tables. Please click on description links to see model screenshots
I am new bie to django ORM and struggling to use ORM.
class Team(models.Model):
country = models.CharField(max_length=3, unique=True)
def __str__(self):
return self.country
...
0
votes
0
answers
20
views
Django dynamic formsets hidden field error
I wanted to add button for dynamcially adding an instance of formset in dajngo. I use django-dynamic-formset for this. The problem is that if I add formset by the button and try to submit the below ...
1
vote
1
answer
19
views
how to overwrite value filled with POST
I'm trying to pass list of ids into hidden field:
the POST result is:
POST in add_document:<QueryDict: {'csrfmiddlewaretoken': ['xxx', 'xxx'], 'person_ids': ['15129', '15161', '15177', '15217'], '...
0
votes
1
answer
33
views
django-smart-selects query filter
I am using django-smart-selects to create chained dropdown forms,
problem is I cannot filter querysets made by this package since it creates its own formsets.
normally i would override init such :
...
1
vote
1
answer
22
views
Django modelform not rendering when included in another template
I'm still fairly new to Django and trying to get through the docs and basics. My sticking point is that I cannot get a working modelform on page X to be included inside of another template Y. It's a ...
0
votes
0
answers
26
views
My django form is not sending the values correctly to my responses page
Im invested on solving the code, theres still some things missing, i took a print
the visual part of the pages seem fine, but theres something wrong with how im sending the values and I cant find ...
0
votes
1
answer
35
views
Split Django ModelForm selection base on previous field
So Im making a booking form, I have my Booking Model :
class Bookings(models.Model):
user = models.ForeignKey(User,on_delete=models.CASCADE, null=True, verbose_name="کاربر",)
...
0
votes
0
answers
20
views
Django nested formsets - 3 levels
I'm working on an app for construction company, and I want to create form for our daily schedule. For this I have 4 models: Date, DailySchedule, WorkersSchedule and MachinerySchedule. Each day we are ...
0
votes
0
answers
9
views
Django appointment app, i want the user to see only available time slots (not taken by another user)
I am coding a Django app for schdeule appointments and i want the user to only see the available timeslots and not all timeslots,
here is my forms.py:
YEAR_CHOICES = ['2023','2024','2025']
...
0
votes
1
answer
49
views
Out of two Django forms and two urls only shown up with one form
One Django form is handling Excel file, while another one is handling video file. But the video file form never shown up... Would like to get any help if anyone gets an idea on what's happening around ...
0
votes
0
answers
20
views
I have django form that is initialized with request, args and kwargs, now I want to create formset from it, how to do it?
class SpecialDateHJRTableEntryForm(forms.ModelForm):
class Meta:
model = HJRTableEntry
fields = ['job_template', 'date']
widgets = {'is_special_date': forms.HiddenInput(...
0
votes
0
answers
8
views
How to horizontal alignment radion button in Django model form with adminlte boostrap theme?
here my model.py
class MedicalRecord(models.Model):
select = (
('Yes','Yes'),
('No','No'),
)
code = models.CharField(max_length=100, null=True, blank=True, unique=True)
...
0
votes
2
answers
29
views
Django Form: Filter and display options based on objects created by user in a form
The current problem is that my form shows the logged-in user all 'decks' ever created. The form should only show 'decks' that the logged-in user created. I can filter the decks from the given user, ...
0
votes
1
answer
34
views
Items not getting store in databse after submit
I am building this website in Django where I am storing locations as "items" inside a databse. Users are allowed to enter a detailed view of each location, and then press a "Rate" ...
1
vote
2
answers
81
views
Override Django Admin Save Model
I want to override Django form save method to be able to create multiple objects at once.
I have an AvailableHours model :
class AvailableHours(models.Model):
free_date = models.ForeignKey(...
1
vote
1
answer
29
views
Override Save to create multiple objects for range()
I want to override Django form save method to be able to create multiple objects at once.
I have an AvailableHours model :
class AvailableHours(models.Model):
free_date = models.ForeignKey(...
0
votes
1
answer
33
views
AttributeError: 'EditViewDevis' object has no attribute 'render'
Need help again.
My aim is to create a quote and allow the user to add items dynamically.
I'm having trouble validating the grouped form: 'EditViewDevis' object has no attribute 'render'.
My ...
0
votes
1
answer
56
views
Django .initial attribute in the form seems doesn't work
I have a problem with my Django project. I have a Model "Fattura" and a Form "EntrataForm", here is the code of the model:
class Fattura(models.Model):
TIPO_CHOICES = [
...
0
votes
1
answer
43
views
How do I make it in a Django project so that after choosing an option in one form, the options in the other form are narrowed?
I'm trying to make my first project in Django which is a unit converter. I want to have a form where you can choose the type of units (like length, area, mass etc.). After choosing the type, then in ...
1
vote
1
answer
43
views
Why aren't my registered users showing on the Django admin panel?
I am relatively new to django. I am developing a user registration system. I have tried testing the user registration but the details aren't getting shown in the admin panel.I can manually add someone ...
1
vote
2
answers
33
views
how to use {{ form.as_p }} in javascript
I've a question, I am a Django developer, in my program I want to write a JavaScript file that when we click a button, the script file create a new form. The javaScript file:
function noid(){
...
0
votes
1
answer
35
views
Why do I get "This field is required" error from Django imageField? [closed]
I have problems with Django's image field. It says that the image field is empty even though I have selected an image
This is my models.py:
from django.db import models
class Post(models.Model):
...
0
votes
0
answers
50
views
Why are my Django form answers being saved multiple times and deleting the contents of another DB table?
I'm a complete beginner to Django and I've created a form of radio selects - each question is dynamically populated from the Questions table of my database. When the form is submitted, it should save ...
0
votes
0
answers
34
views
How to use the User built in model as a default value of another form?
I am working on a project dealing with the built-in User model. I have a class that showed me how to use the User model...Registering, Login/Logout, Dashboard, Being able to update a user's profile, ...
2
votes
2
answers
77
views
Django Password Reset Form Not Showing When Using DRF, Works from Website
I'm facing an issue with my Django application involving the password reset functionality. When the password reset link is sent via the standard Django website flow, everything works as expected: the ...
0
votes
0
answers
26
views
Handling formsets in Django
In my django project, I want to use formsets, but I have a problem with handling the POST requests.
I defined my formset this way:
strategy_settings = formset_factory(StrategySettings)
...
1
vote
1
answer
16
views
My django checkbox group is not recieving the values as valid, what do I do?
im new to django and only dived into because of a student project im doind, and theres a problem with this checkbox that i dont understand...
<div class="form-group">
&...
0
votes
1
answer
34
views
Button for adding an instance of formset in Django
I want to create a button for dynamically adding and removing an instance of formset from the displayed page. It is my first experience with formset in Django and I do not know any JavaScript, so I ...
0
votes
0
answers
20
views
How to show level from Django MPTTModel in template?
I'm using django-mptt to store a hierarchical data (A Story with a number of scenes, in which each scene is a child of another scene) in DB. The data is for each node(scene) is collected from the ...
-1
votes
0
answers
65
views
(Django, Ajax, FormMixin, Forms) 500 (Internal Server Error) Error submitting form on mobile phone
To send and receive a response I use Ajax, Django and the Based View class.
I want to implement form submission via Ajax so that the page does not reload after submitting the form.
To receive the form ...
0
votes
0
answers
10
views
Store queryset in local storage
I want to store a queryset result from a form submission to restore its state once it is accesed again. I have tried using,localStorage,cache but both of them are giving problems that instead of ...
1
vote
1
answer
29
views
Movie cast with characters in Django
So, I'm doing the classical movie app in Django (I'm loving the framework!) and I feel like I hit a stump.
So, I have my Movie model:
class Movie(models.Model):
TitlePRT = models.CharField(...