Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

28. Reviews Dropdown Styling is not working #21

Open
plumped opened this issue May 5, 2022 · 3 comments
Open

28. Reviews Dropdown Styling is not working #21

plumped opened this issue May 5, 2022 · 3 comments

Comments

@plumped
Copy link

plumped commented May 5, 2022

Hey there!

In Lection "28. Reviews" the styling is not working for the Dropdown. Also the custom labels are not shown which where mentioned by Dennis. There are a lot of other students with the same issue... Could you please respond with a solution here and also in the Udemy Comment section?

Thanks a lot!

@plumped
Copy link
Author

plumped commented May 5, 2022

image

@plumped
Copy link
Author

plumped commented May 5, 2022

projects/forms.py

from django.db.models.base import Model
from django.forms import ModelForm, widgets
from django import forms
from .models import Project, Review


class ProjectForm(ModelForm):
    class Meta:
        model = Project
        fields = ['title', 'featured_image', 'description',
                  'demo_link', 'source_link']
        widgets = {
            'tags': forms.CheckboxSelectMultiple(),
        }

    def __init__(self, *args, **kwargs):
        super(ProjectForm, self).__init__(*args, **kwargs)

        for name, field in self.fields.items():
            field.widget.attrs.update({'class': 'input'})

        # self.fields['title'].widget.attrs.update(
        #     {'class': 'input'})

        # self.fields['description'].widget.attrs.update(
        #     {'class': 'input'})


class ReviewForm(ModelForm):
    class Meta:
        model = Review
        fields = ['value', 'body']
        labels = {
            'value' : 'Place your vote',
            'body' : 'Add a comment with your vote'
        }

    def __init__(self, *args, **kwargs):
        super(ReviewForm, self).__init__(*args, **kwargs)

        for name, field in self.fields.items():
            field.widget.attrs.update({'class': 'input'})

@DunLei79
Copy link

DunLei79 commented Jul 28, 2022

FIX def must be in the class its a spacing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants