Category "django-forms"

django - How to auto-populate existing data in django form while updating

I want to auto populate my update form in django with the existing data, but instance=request.user and instance=request.user.profile seems not to be auto popula

Can not get comment id with AJAX in django

I'm fighting with this problem during several days and can not find the solution for my case. I'm trying to make system of likes without refreshing the page. In

django don't show form in template

django dont show my form in my template where is the problem? forms.py from django import forms class QuestionForm(forms.Form): massage = forms.CharField(w

How to assign new value to a ModelForm field which form edits user data, to test if the data will be edited Django test TestCase

I'm testing Django forms handling and trying to test a ModelForm, which form edits the user's data. I tried to write the test in several ways, but each one thro

How to print multiple object from table def __str__(self):return self.title

I created a article models below models.py class Article(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, blank=True) is_deleted

How can we add more than 3 authors field for a single magzine? in Django models

I created a magzine model in django. But their are more than three authors of a magzine. I have written below code for three authors. If I write the code of two

How to make Dropdown with input field in django form

I am a noob to django and python 😥 I have a django form, it needs a dropdown menu with input field to enter the text which is not listed in dropdown. Is

Color the cell of a table depending on the value using javascript

I am trying to color cells of an HTML table (which is automatically generated by Python and Django) depending on cells' content. Here is my table. I would like

Django - After Register, Data Should Go To 2 Different Tables (Customer & User)

I am creating an e-commerce website where people can choose to login or not but still the can order and checkout (even if you are an AnonymousUser or Guest user

Using CreateView with 2 Models at the same time

should I be building a function to achieve what I am trying to do?

Django forms not valid

I am using custom django forms. It seems that my form is not valid. I can't find the error. Could you help please?? signup.html`

django redirect to form view and autofill with previously entered values

I have following scenario. User fills out a form If the user clicks the "continue" button and the form is valid the user will be redirected to a summary view In

Django Assigning or saving value to Foreign Key field

can any one help me with assigning value to a foreign key field. Im trying to create user profile where user can add there countries. when creating the models,

How to add attributes to a Django form widget's media fields?

I can render media files for a django form, through a custom widget, like this: class TinyMCEWidget(Textarea): def __init__(self, attrs=None): if a

Allow empty foreign key selection in admin forms

I created a model(AnalysisFieldTemplate) with a foreign key to AnalysisFieldRule. What i want is to have the possibility to leave the field display_analysis_fie

Django AuthenticationForm is not validating and not storing information in database

So basically I'm trying to do a simple login system using Django AuthenticationForm and LoginView. The form takes the user input and when the login button is pr

Django-registration - How to check if email exists in database

During registration currently when a user is entering an existing username and an email it is notified that this username already exists in database. When the u

How can I display data from django model and save at the same time using class based views?

I am creating a quiz app using Django. The requirements are: I need to first display all the topics available for the quiz on the homepage. Clicking on a partic

TypeError: 'BasePermissionMetaclass' object is not iterable in django rest framework

i looked at other questions regarding this issue and their problems were in the REST_FRAMEWORK = ... values in settings.py file . is there any error in mine ? I

how to make custom form without database - DJANGO

So i want to upload file but only sent to locals storage NOT DATABASE too. But i don't know how to make custom forms. suddenly, here's my models.py : from djang