RachWalm / VolunteerVillage

Project 4 for Code Institute
0 stars 1 forks source link

Bug: volunteer profile form no longer saving now I have added a many-to-many field. #99

Open RachWalm opened 9 months ago

RachWalm commented 9 months ago

Story

As a devloper, I can save information through the site not just the admin so that I can the site is able to save information.

Acceptance Criteria

Tasks

RachWalm commented 9 months ago

Stopped working when the many to many field was added to the model. Looks like the form is no longer form.is_valid() as this is where it stops for form2 which is where the many to many is. As it is in an if statement it now just skips over the form saving as form is not valid

RachWalm commented 9 months ago

There is some discussion that if commit = false then a save_m2m is required, but I haven't got this working yet.

RachWalm commented 9 months ago

<ul class="errorlist"><li>Enter a list of values.</li></ul>

Is the error that I think needs to be solved as this is what the form is outputting instead of the skilled value

RachWalm commented 9 months ago

got a list of values into this above error which still allowed me to select multiple values on the screen, this was done by going back to the models and creating:

def SavedList(): skill_queryset = SkillChoices.objects.filter().values() skill_list = set(skill_queryset.values_list()) return skill_list

this skill_list could then be put into choices which didn't work with SKILL_CHOICES list to remain as a multiple select option.

However this many to many still isn't actually saving any data and it looks like the HTML output thinks that only one option is saving.

It has been suggested that I try using set() functionality, but I haven't got this working yet.

RachWalm commented 8 months ago

Deleted all of the 'fixes' and typed it out again and it is working. Suspect a typo or spelling mistake.