django-tagging

Django - Global navigation in base.html using model

时光总嘲笑我的痴心妄想 提交于 2019-12-12 21:09:08
问题 I have a number of templates that extend base.html . I want the base.html template to house my global navigation and have the text and links in the global navigation be based on a model Division (i.e. the CharField in the model will be used as the button text in the global nav, and the id will be used to build the URL). I thought tags might work, but what I end up with is this (yes, I'm new to Django and Python): current_tags.py from django import template # Import your model from libs

Django: Passing HTML string to template

懵懂的女人 提交于 2019-12-10 01:37:02
问题 I'm having an issue while trying to display a html chunk of code created on a django view. Here's what's happening. On my view, I'm trying to pass to the template a bunch of book descriptions which I'll hide/show according to user action. These descriptions are stored in html files on the server. def my_view() #loop through the list of books, read their corresponding a html file, and parse it to fill in the book details #code, code, code... #take the resulting string, append it on books

Django's I18N with third-party apps

人走茶凉 提交于 2019-12-05 15:42:44
问题 I have a Django project which uses django-tagging and is supposed to run in German. So I looked into the sources and found that django-tagging does indeed use gettext_lazy and is thus completely translatable. However, there are no translations available in the package. So I assume there must be a way for me to translate it from within my project. In other words, I expect ./manage.py makemessages -a to include untranslated strings from django-tagging , but apparently I'm wrong to expect that.

Django: Passing HTML string to template

本小妞迷上赌 提交于 2019-12-05 00:49:45
I'm having an issue while trying to display a html chunk of code created on a django view. Here's what's happening. On my view, I'm trying to pass to the template a bunch of book descriptions which I'll hide/show according to user action. These descriptions are stored in html files on the server. def my_view() #loop through the list of books, read their corresponding a html file, and parse it to fill in the book details #code, code, code... #take the resulting string, append it on books description array, log it and send it to template logger.debug(books_description["Clockwork orange"]) return

Organizing django-tagging tags or assigning properties to tags?

▼魔方 西西 提交于 2019-12-01 07:45:27
问题 I'd like to categorize my tags. Here's an example of the tags I have now: css, internet-explorer, firefox, floats Each of those are separate tags ( 4 in total obviously ). I would like to mark the internet-explorer and firefox tags as browsers. Does django-tagging offer some sort of way for doing this or do I have to manually edit the schema? I really don't care if I have to either tag tags or add a new column to the tags table, whichever is the easiest way in accordance with the plugin. 回答1:

Categories of tags

风流意气都作罢 提交于 2019-11-30 15:45:10
I'm starting a pro bono project that is the web interface to the world's largest collection of lute music and it's a challenging collection from several points of view. The pieces are largely from 1400 to 1600, but they range from the mid-1200's to present day. Needless to say, there is tremendous variability in how the pieces are categorized and who they are attributed to. It is obvious that any sort of rigid, DB-enforced hierarchy isn't going to work with this collection, so my thoughts turn to tags. But not all tags are the same. I'll have tags that represent a person/role (composer,

Categories of tags

房东的猫 提交于 2019-11-29 22:55:22
问题 I'm starting a pro bono project that is the web interface to the world's largest collection of lute music and it's a challenging collection from several points of view. The pieces are largely from 1400 to 1600, but they range from the mid-1200's to present day. Needless to say, there is tremendous variability in how the pieces are categorized and who they are attributed to. It is obvious that any sort of rigid, DB-enforced hierarchy isn't going to work with this collection, so my thoughts

‘Machine tags’ referencing model instances in Django

故事扮演 提交于 2019-11-29 18:02:13
Example problem Say, you have models Publication , Photo , Event and Person ; they could relate to each other in different ways. Particularly, publications can have 1) some illustrations (related photos) and 2) some mentioned personas. Events can have some 3) photos and 4) people related as well. Also, 5) events could be mentioned in publications. No additional data needs to be associated with relationships, except for illustrations: they need a position field for sorting. So in that case (#1), it's OK to go with intermediate model like Illustration referencing photo and publication and

How make tags with properties in Django?

我们两清 提交于 2019-11-29 12:34:00
The django-tagging app provides basic tagging functionality. I need each tag also to have properties (category, description, etc.), basically a related table. What's your recommendation, should I try to get this with django-tagging or implement "my tagging" from scratch? Create a model to hold your tag metadata. With a tag instance you can look up the model instance to learn the category, description, etc. You could even tag the metadata instance with the tag if you find that makes things easier. 来源: https://stackoverflow.com/questions/3542388/how-make-tags-with-properties-in-django

‘Machine tags’ referencing model instances in Django

自古美人都是妖i 提交于 2019-11-28 12:55:14
问题 Example problem Say, you have models Publication , Photo , Event and Person ; they could relate to each other in different ways. Particularly, publications can have 1) some illustrations (related photos) and 2) some mentioned personas. Events can have some 3) photos and 4) people related as well. Also, 5) events could be mentioned in publications. No additional data needs to be associated with relationships, except for illustrations: they need a position field for sorting. So in that case (#1