Skip to content
Shop

CommunityJoin Our PatreonDonate

Sponsored Ads

Sponsored Ads

Problem 2

Add another option for year to search group

Problem Name

py
class SearchGroup:
    options = [
            {
                'value': 'id',
                'label': 'search_id',
                'placeholder': 'Enter your...',
                'validationMessage': 'Please enter',
                'position': '1'
            }
        ]
    @classmethod
    def add_year(cls):
        cls.options.append(
             {
                'value': 'id',
                'label': 'year',
                'placeholder': 'Enter your...',
                'validationMessage': 'Please enter',
                'position': '2'
            })
        return cls.options

print(SearchGroup.add_year())

Posts.vue

<ul>
<li v-for="(id,post) in posts" :key="id">
    {{post}}
</li>
</ul>

Approach

Do this and that like this

Solution

Solution
py
class SearchGroup:
    options = [
            {
                'value': 'id',
                'label': 'search_id',
                'placeholder': 'Enter your...',
                'validationMessage': 'Please enter',
                'position': '1'
            }
        ]
    @classmethod
    def add_year(cls):
        cls.options.append(
             {
                'value': 'id',
                'label': 'year',
                'placeholder': 'Enter your...',
                'validationMessage': 'Please enter',
                'position': '2'
            })
        return cls.options

print(SearchGroup.add_year())

Resources