Monday, April 30, 2018

RE: Crazy Idea: OOP for "Hyperlink"

Here's Django's documentation on widgets:

https://docs.djangoproject.com/en/2.0/ref/forms/widgets/

From the docs:

A widget is Django's representation of an HTML input element.

 

This whole idea would take some time to implement and consider ramifications.  After all, a hyperlink isn't really an HTML input element.

 

You have urlpatterns being a list of url objects.  If you could somehow take the attributes of the url object and copy them to a widget (through an __init__ method, for instance), and allow the user to customize those attributes in the URLWidget class.  The really tricky thing about it, though, would be handling permissions.

 

I think it is a DRY way of handling the situation.

 

So the data comes from your urls file, where it is also stored.  The input of the widget would be the url objects from the urls file.

 

 

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of guettli
Sent: Monday, April 30, 2018 2:25 AM
To: Django users
Subject: Re: Crazy Idea: OOP for "Hyperlink"

 



Am Donnerstag, 26. April 2018 15:54:31 UTC+2 schrieb Matthew Pava:

I've been thinking about your idea, and I wonder if there could instead be some kind of widget for URL objects (or views).

 


A widget ... Let me think about it. A widget is a libray, is source code.
The code needs some data to operate on.
Where should the data come from? Where should I store the data?
What kind of data/input does the widget need?

I have no clue

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fd48e249-9d57-43f5-87e4-09bed383af62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment