from django import forms
from django.forms.models import ModelForm
from installer_config.models import EnvironmentProfile, Package, TerminalPrompt
 

class EnvironmentForm(ModelForm):
    packages = forms.ModelMultipleChoiceField(widget=forms.CheckboxSelectMultiple,
                                              queryset=Package.objects.all())

    class Meta:
        model = EnvironmentProfile
        exclude = ('user',)

from django import forms
from django.forms.models import ModelForm
from installer_config.models import EnvironmentProfile, UserChoice
 

class EnvironmentForm(ModelForm):
    packages = forms.ModelMultipleChoiceField(widget=forms.CheckboxSelectMultiple,
                                              queryset=UserChoice.objects.all())

    class Meta:
        model = EnvironmentProfile
        exclude = ('user',)

Fix form to query UserChoices, not Packages
Fix form to query UserChoices, not Packages

  from django import forms
  from django.forms.models import ModelForm
- from installer_config.models import EnvironmentProfile, Package, TerminalPrompt
+ from installer_config.models import EnvironmentProfile, UserChoice
   
  
  class EnvironmentForm(ModelForm):
      packages = forms.ModelMultipleChoiceField(widget=forms.CheckboxSelectMultiple,
-                                               queryset=Package.objects.all())
+                                               queryset=UserChoice.objects.all())
  
      class Meta:
          model = EnvironmentProfile
          exclude = ('user',)
  
Fix form to query UserChoices, not Packages
## Code Before:
from django import forms
from django.forms.models import ModelForm
from installer_config.models import EnvironmentProfile, Package, TerminalPrompt
 

class EnvironmentForm(ModelForm):
    packages = forms.ModelMultipleChoiceField(widget=forms.CheckboxSelectMultiple,
                                              queryset=Package.objects.all())

    class Meta:
        model = EnvironmentProfile
        exclude = ('user',)

## Instruction:
Fix form to query UserChoices, not Packages
## Code After:
from django import forms
from django.forms.models import ModelForm
from installer_config.models import EnvironmentProfile, UserChoice
 

class EnvironmentForm(ModelForm):
    packages = forms.ModelMultipleChoiceField(widget=forms.CheckboxSelectMultiple,
                                              queryset=UserChoice.objects.all())

    class Meta:
        model = EnvironmentProfile
        exclude = ('user',)
