Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9268249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:45:42+00:00 2026-06-18T14:45:42+00:00

I have quite unique problem with django. Im providing website users interface for editing

  • 0

I have quite unique problem with django.

Im providing website users interface for editing large data. Each row on this data represents a row in database. Or one object of certain Type.

Users click on cells in the table and form opens where they can edit this fields/column value.

In essence it works like this:
1) based on where user clicks, query is sent to server containting object id and the field that he is editing.
2) based on this information form is created on the fly:

class FieldEditorForm(forms.ModelForm):
    class Meta:
        model = MyObject
        fields = ['id', field ]

Notice the field there is Variable not name of the field.

3) this field passes its own modelform validation and all is fine. in save method Model.save() is enough to update the value.

But now to the problem. Sometimes empty value is sent to server in this form. Empy value such as u” or almost emtpty like u’ ‘. I want to repace this with None so NULL would be saved to database.

There are two places where i could do that. In field validation modifying the cleaned_data or in form save method.

Both approaches raise unique problem as i dont know how to create variable function names.

def clean_%(field)s(): 

or in case of form save method

r.%(field)s = None

is what i need, but those methods dont work. So how can i create method name which is variable or set objects variable parameter to something. Is it even possible or do i have to rethink my approach there?

Alan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:45:44+00:00Added an answer on June 18, 2026 at 2:45 pm

    In the latter case, setattr(r, field + 's', None).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have wrecked my brain on this problem for quite some time. I've also
Here is my problem. I have a dataset with 200k rows. Each row corresponds
I have quite a problem concerning the use of relational database concepts in Delphi
I have quite a large VB6 project, with many forms, classes, modules and user
I have quite a large table with 19 000 000 records, and I have
I have almost completed the code for this problem, which I shall state as
our task is quite simple, we have an object graph where each object (IDItem)
The problem is quite simple, I have a method that returns a list. I
I have looked around some now to find a solution to this problem. I
I've written quite a few jQuery plugins in the past and this problem has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.