Skip to content

(DRF 3.0) Added missing default style for FileField #2065

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

Closed
wants to merge 3 commits into from
Closed

(DRF 3.0) Added missing default style for FileField #2065

wants to merge 3 commits into from

Conversation

kchang
Copy link
Contributor

@kchang kchang commented Nov 12, 2014

The browsable api forms were missing file inputs for FileField. This was easily added by including the information in HTMLFormRenderer.default_style

Before:
screen shot 2014-11-12 at 1 10 46 pm

After:
screen shot 2014-11-12 at 1 11 29 pm

@tomchristie
Copy link
Member

Good catch yup!
The styling seems a little odd - wasn't really expecting the white surround. May be worth looking at (we can always have a separate template for file inputs if needed?

@tomchristie tomchristie added this to the 3.0 Release milestone Nov 12, 2014
@kchang
Copy link
Contributor Author

kchang commented Nov 12, 2014

Taking out class="form-control" removes the white outline box around the file input.

After:

screen shot 2014-11-12 at 2 24 28 pm


{% block input %}
<input name="{{ field.name }}" type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
{% endblock %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've avoided block overriding at all costs so far.

Either we can:

  • Have form-control be something that's passed to all other input fields except file in the context.
  • Not write form_control if style.input_type == file.
  • Go with what you have here, but be explicit rather than using block overriding.

Additionally we need to make the same fix for the vertical and inline styles.

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

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy