Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a model type can store tags in django?

I want to write a blog by Django, in a blog post there will be some tags, but I don't know which model type can implement this function.

Is there a model type can store tags in django?

like image 937
Tanky Woo Avatar asked Aug 25 '12 07:08

Tanky Woo


People also ask

How does Django store data in models?

Creating objectsTo create an object, instantiate it using keyword arguments to the model class, then call save() to save it to the database. This performs an INSERT SQL statement behind the scenes. Django doesn't hit the database until you explicitly call save() . The save() method has no return value.

What is model metadata in Django?

Model Meta is basically the inner class of your model class. Model Meta is basically used to change the behavior of your model fields like changing order options,verbose_name, and a lot of other options. It's completely optional to add a Meta class to your model.

Is there a list field in Django models?

If you are using Google App Engine or MongoDB as your backend, and you are using the djangoappengine library, there is a built in ListField that does exactly what you want.


1 Answers

Three years on and, in Django 1.8, there is a field type that can store tags, if you're using Postgres: ArrayField.

like image 148
Phil Gyford Avatar answered Sep 19 '22 16:09

Phil Gyford