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

  • Home
  • SEARCH
  • 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 3308534
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:31:58+00:00 2026-05-17T21:31:58+00:00

I’ve been searching and trying to get this to work for the past few

  • 0

I’ve been searching and trying to get this to work for the past few hours and I can’t

I have a list of skills that I take from the database:

forms.ModelMultipleChoiceField(
                              skills.objects.all(), 
                              required=True, 
                              widget=forms.CheckboxSelectMultiple(),
                              label='Check your skills.',
                              initial=skill_list.objects.filter(user='void'),
                              )

but this isn’t working as I would expect it to work. I basically want to display the list of skills (all of them) and the ones that the user has checked to be checked … pff I cant even explain right.

After the user checks the checkbox and hits submit in another page I want to display all skills and the one the user checked to be checked.

Lets say I have a b c and the user checks b and hits submit when in w/e page I want to display a uncheked b checked c unchecked.

PS: If I use skills.objects.all(), I get in the HTML value 1 and a how can I make it like this:

skills = (
         ('a', 'a'),
         ('b', 'b'),
         )  

Instead of ('1', 'a'), ('2', 'b').

  • 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-17T21:31:58+00:00Added an answer on May 17, 2026 at 9:31 pm

    Your question(s) are a little unclear, but il still try my best.

    Firstly,

    I wanna display all skills and the one
    the user checked to be checked …

    The form doesnot have access to the user, so you need to pass it the user. You could do this by overloading the __init__ method like so:

        def __init__(self, **kwargs):
            current_user = kwargs.pop ('user')
            super(FormName, self).__init__(attrs)
    

    then for setting the initially chosen values,

    self.fields['skills'].initial = skill_list.objects.filter(user='void')
    

    Remember you must do this after calling the constructor of the base class.

    Finally,

    PS: if i use skills.objects.all() I
    get in the html value 1 and a how can
    I make this as

    skills = (
    (‘a’, ‘a’),
    (‘b’, ‘b’),
    )

    instead of (‘1’, ‘a’), (‘2’, ‘b’)

    Why would you want to do that? The numbers are the primary keys of the rows from you ‘skills’ table. Django uses this to setup the appropriate relationships.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.