Opened 7 months ago

Closed 7 months ago

Last modified 7 months ago

#35261 closed Bug (fixed)

Media Path as Objects - Documentation fix and usage example

Reported by: Leandro de Souza Owned by: Leandro de Souza
Component: Documentation Version: 4.1
Severity: Normal Keywords: Documentation, Media
Cc: Leandro de Souza Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Leandro de Souza)

Related conversation on forum: https://forum.djangoproject.com/t/media-path-as-objects/28470

Issue: The documentation for Media Path as Objects https://docs.djangoproject.com/en/4.1/topics/forms/media/#paths-as-objects uses an incorrect attribute (rel) on a script tag, source: HTML attribute: rel - HTML: HyperText Markup Language | MDN https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel. Quoted from the source:

The rel attribute defines the relationship between a linked resource and the current document. Valid on <link>, <a>, <area>, and <form>, the supported values depend on the element on which the attribute is found.

Another thing is that the example given for the usage of this new feature added on 4.1 is not really that useful. The JSPath class in the example is just a hardcoded script tag that illustrates how to use the __str__ method to render the tag.

I believe that adding a more useful example would add more "bright" to the value that this feature has providen: adding flexibility. Some usage examples of this new feature has been added to the conversation on the forum.

I would be happy to work on this patch/fix.

Change History (8)

comment:1 by Leandro de Souza, 7 months ago

Description: modified (diff)

comment:2 by Carlton Gibson, 7 months ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

As per the discussion, I’ll accept to fix the error with the rel tag.

I’d suggest doing that in an initial commit.

Then, I think there’s some review to be done to judge the “better example” right. (Enough but not too much)

comment:3 by Leandro de Souza, 7 months ago

Owner: changed from nobody to Leandro de Souza
Status: newassigned

comment:4 by Leandro de Souza, 7 months ago

After reading the docs on how to submit a patch, i haven't figured it out from which branch should my patch be based. Should it be from the django's "main" branch?

comment:5 by Leandro de Souza, 7 months ago

Has patch: set

Opened the pull request https://github.com/django/django/pull/17926 for the initial patch.
Waiting for new directives about the more "detailed" examples mentioned.
Cheers and thanks!

comment:6 by Mariusz Felisiak, 7 months ago

Triage Stage: AcceptedReady for checkin

comment:7 by GitHub <noreply@…>, 7 months ago

Resolution: fixed
Status: assignedclosed

In 368a8a3:

Fixed #35261 -- Corrected Media JS example of object-based paths in docs.

rel attribute is not valid on <link> tags.

comment:8 by Mariusz Felisiak <felisiak.mariusz@…>, 7 months ago

In 17855bf:

[5.0.x] Fixed #35261 -- Corrected Media JS example of object-based paths in docs.

rel attribute is not valid on <link> tags.
Backport of 368a8a3a83885a13776a530920f0317a40e7989d from main

Note: See TracTickets for help on using tickets.
Back to Top