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 6676361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:58:43+00:00 2026-05-26T03:58:43+00:00

I have a form with KeywordInline . When I add new object using the

  • 0

I have a form with KeywordInline. When I add new object using the form inlined formset has a js-link to add new form into formset. Newly added forms have a js-enabled delete button (x mark on the right).

KeywordInline

class KeywordInline(admin.TabularInline):
    fields = ('word',)
    model = models.Keyword
    formset = forms.KeywordFromset
    verbose_name = _('Keyword')
    verbose_name_plural = _('Keywords')
    extra = 1
    can_delete = True

    def get_readonly_fields(self, request, obj=None):
        if obj:
            if str(obj.status) == 'Finished':
                self.extra = 0
                self.can_delete = False
                self.max_num = obj.keyword_set.count()
                return ('word',)

        self.extra = 1
        self.can_delete = True
        self.max_num = None
        return []

KeywordFromset

class KeywordFromset(BaseInlineFormSet):
    def clean(self):
        super(KeywordFromset, self).clean()
        formset_keywords = set()
        for form in self.forms:
            if not getattr(form, 'cleaned_data', {}).get('word', None):
                keyword = None
            else:
                keyword = form.cleaned_data['word']
            if keyword in formset_keywords:
                form._errors['word'] = ErrorList([_(self.get_unique_error_message([_('Keyword')]))])
            else:
                formset_keywords.add(keyword)

Now if I hit save button and ValidationError rises those delete buttons disappears from fromset. So if I’ve added wrong keyword mistakenly I cannot delete it.

Is this normal behaviour? And how can I make delete links persist?

Any help is much appreciated.

  • 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-05-26T03:58:43+00:00Added an answer on May 26, 2026 at 3:58 am

    There’s no delete link for the inlines that triggered ValidationError since they aren’t yet saved to a database, hence no delete link.

    I realize it’s inconsistent behavior (since you can delete those rows before hitting “save” button, but you can’t once they triggered validation errors), but its normal, default way of how Django does it.

    To fix this, you could override the template for inline and make the delete buttons appear despite validation errors.

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

Sidebar

Related Questions

I have form, where some fields are looks like rows, so I can add/delete
I currently have form that checks if a user has unsubmitted changes when they
I have form object that I set to request in GET request handler in
I have form and form text field which generates dynamically using JSP. And I'm
I have form data that I insert into a database when the user clicks
i have form and i am using jquery validate jquery.validate.pack.js its work fine when
i have form that has multiple input text boxes, Which has got some text
I have Form responsible for logging all neccessary informations from all thread into its
I have form that is loaded into a FancyBox window. I would like to
I have form that has a restricted size and the overflow style set to

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.