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

Rendering problem #470

Open
alexandergoncharovaspecta opened this issue Jan 22, 2025 · 3 comments
Open

Rendering problem #470

alexandergoncharovaspecta opened this issue Jan 22, 2025 · 3 comments

Comments

@alexandergoncharovaspecta

Hello

Could anybody help to understand why I get such problem with rendering empy lists. It has been deployed on ubuntu + apache. All works fine but
on all forms empty lists are rendered as []

Thx

Image

@horilla-opensource
Copy link
Owner

Hi @alexandergoncharovaspecta !

This issue with rendering empty lists as [] on Apache is something we've encountered before. Typically, Apache has some quirks with handling web traffic and redirects, which can cause this behavior. As you mentioned, using Nginx doesn't seem to produce this issue.

After investigating, we found that the problem stems from how Apache handles certain requests, and we've already worked on a fix for this. The solution will be included in the next release of Horilla CBV.

As part of the update, we’ve also modified the HTML rendering for form fields. We’ve added an if condition around the {{ field.errors }} to prevent rendering it when no errors are present. Here's the fix:

{% if field.errors %}
  {{ field.errors }}
{% endif %}

You can also try this by manually updating your HTML file: find the line {{ field.errors }} and replace it with:

{% if field.errors %}
  {{ field.errors }}
{% endif %}

This should resolve the issue if you need a quick fix with your current source code of Horilla.

Thanks for pointing it out, and we hope this resolves the issue for you once the update is live!

Best Regards,
Team Horilla

@alexandergoncharovaspecta
Copy link
Author

Thank you very much for quick response. Yes I already fixed problem by changing code in templates but still is not clear how appache can influence on rendering. By the way I did not tested it in NGINX I said that from pycharm (development) It works (renders) correctly.

@horilla-opensource
Copy link
Owner

Hi @alexandergoncharovaspecta,

You're welcome! We're glad to hear the template fix worked for you.

To clarify, Apache itself doesn't directly influence the rendering of HTML in your application. However, its configuration and how it handles requests (like caching, headers, or encoding) can sometimes cause unexpected behavior, especially compared to the development environment. For instance, differences in how Content-Type headers or template files are processed could affect what gets rendered.

Best Regards,
Team Horilla

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