{"id":664,"date":"2018-03-22T20:13:00","date_gmt":"2018-03-22T20:13:00","guid":{"rendered":"https:\/\/codenerix.com\/?p=664\/"},"modified":"2023-04-06T06:57:42","modified_gmt":"2023-04-06T06:57:42","slug":"genlist","status":"publish","type":"post","link":"https:\/\/codenerix.com\/en\/genlist\/","title":{"rendered":"GenList"},"content":{"rendered":"\n<p>\ud83c\uddea\ud83c\udde6&nbsp;Leer en Espa\u00f1ol, \u201c<a href=\"https:\/\/www.juanmitaboada.com\/codenerix-genlist\/\">GenList<\/a>\u201c<\/p>\n\n\n\n<p>Previously we talked about <a href=\"https:\/\/codenerix.com\/en\/codenerixmodel\/\">CodenerixModel<\/a> to understand how a functional model is built with <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a>;<\/strong><\/span><\/strong><span style=\"color: #343433;\"> however, for everything to work in Django, in addition to models you also have to define views. To allow web content to be viewed, a set of inheritable views is <\/span>available to the programmer, all based on <strong>Django<\/strong>&#8216;s <strong>Generic Views<\/strong>, which, following the <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong> policy, are as simple to use as to inherit from them.<\/p>\n\n\n\n<p>In this article, we will talk about <strong>GenList<\/strong>, which is the generic view of <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong> that allows you to view data as a list from the model. <strong>GenList<\/strong> inherits directly from <strong>Django<\/strong>&#8216;s <strong>ViewList<\/strong>, so all properties of a <strong>ViewList<\/strong> are available in <strong>GenList<\/strong>. Let&#8217;s see what the list of a &#8220;<strong>Contact<\/strong>&#8221; model would look like:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from codenerix.views import GenList\nfrom app.models import Contact\n\nclass ContactList(GenList):\n    model = Contact<\/pre>\n\n\n\n<p>As simple as that, and the visual result would be equivalent to something like this (if you use the <a href=\"https:\/\/github.com\/codenerix\/django-codenerix-examples\"><strong><span style=\"color: #343433;\"><strong><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/strong><\/span><\/strong> Examples<\/a>):<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"508\" src=\"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list-1024x508.png\" alt=\"\" class=\"wp-image-665\" srcset=\"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list-1024x508.png 1024w, https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list-980x486.png 980w, https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list-480x238.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>In this way we have managed to visualize the Contact model of the &#8220;agenda&#8221; example that you have here:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class Contact(CodenerixModel):\n    first_name = models.CharField(verbose_name=_(u'Name(s)'), max_length=128)\n    last_name = models.CharField(verbose_name=_(u'Last name'), max_length=128, blank=True, null=True)\n    alias = models.CharField(verbose_name=_(u'Alias'), max_length=32, blank=True, null=True)\n    organization = models.CharField(verbose_name=_(u'Organizaci\u00f3n'), max_length=64, blank=True, null=True)\n    borndate = models.DateField(verbose_name=_(u'Cumplea\u00f1os'), blank=True, null=True)\n    address = models.TextField(verbose_name=_(u'Direcci\u00f3n'), blank=True, null=True)\n    created_by = models.ForeignKey(User, verbose_name=_(u'Creado por'), on_delete=models.CASCADE, related_name='contacts')\n\n    def __fields__(self, info):\n        return (\n            ('first_name', _(Name(s)')),\n            ('last_name', _(Last name')),\n            ('alias', _(u'Alias')),\n            ('organization', _(u'Organization')),\n        )<\/pre>\n\n\n\n<p>You may have already noticed that <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong> has used the <strong><em>__fields__<\/em><\/strong> method of the model to discover which fields it should display in the list. In addition, it felt free enough to <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">automatically<\/mark><\/strong> offer a list that enables <strong>cumulative ascending\/descending sorting <\/strong>in each of its fields (see &#8220;Last name&#8221; column in the following screenshot) and if we press the <strong>filter<\/strong> icon (<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">light<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\"> <\/mark><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">blue<\/mark><\/strong> colour in the following screenshot ) we can even see that it has also taken care of allowing us to <strong>search in each  field<\/strong> one by one (see &#8220;Organization&#8221; column where we search for &#8220;Inc&#8221; limiting the list to 2 results):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"540\" src=\"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list_filtered-1024x540.png\" alt=\"\" class=\"wp-image-666\" srcset=\"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list_filtered-1024x540.png 1024w, https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list_filtered-980x516.png 980w, https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list_filtered-480x253.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>In short, by inheriting from <strong>GenList<\/strong> we have achieved a great job with an excellent visual result for our users.<\/p>\n\n\n\n<p>But <strong>GenList<\/strong>, like <strong><a href=\"https:\/\/codenerix.com\/en\/codenerixmodel\/\">CodenerixModel<\/a><\/strong>, allows you to use the methods: <em>__fields__<\/em>, <em>__limitQ__<\/em>, <em>__searchF__<\/em> and <em>__searchQ__<\/em>. In this way, when one of these methods is created in a <strong>GenList<\/strong>, the <strong><strong><a href=\"https:\/\/codenerix.com\/en\/codenerixmodel\/\">CodenerixModel<\/a><\/strong><\/strong> or <strong>GenList<\/strong> method will be used as they exist. In fact, its operation is exactly the same as in <strong><a href=\"https:\/\/codenerix.com\/en\/codenerixmodel\/\">CodenerixModel<\/a><\/strong>.<\/p>\n\n\n\n<p>The following 3 tables show 3 columns:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <strong>first<\/strong> indicates if the method is defined in <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"><strong><strong><a href=\"https:\/\/codenerix.com\/en\/codenerixmodel\/\">CodenerixModel<\/a><\/strong><\/strong><\/mark>.<\/li>\n\n\n\n<li>The <strong>second<\/strong> indicates if it is defined in <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"><a href=\"https:\/\/codenerix.com\/en\/genlist\/\"><strong>GenList<\/strong><\/a><\/mark>.<\/li>\n\n\n\n<li>The <strong>third<\/strong> column indicates the result of applying these filters.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>__fields__<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">CodenerixModel<\/mark><\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">GenList<\/mark><\/strong><\/td><td><strong>Applicable<\/strong><\/td><\/tr><\/thead><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">NO<\/mark><\/td><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">NO<\/mark><\/td><td><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u2014 ERROR \u2014<\/mark><\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">NO<\/mark><\/td><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">YES<\/mark><\/td><td><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u2014 ERROR \u2014<\/mark><\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">YES<\/mark><\/td><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">NO<\/mark><\/td><td><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">CodenerixModel<\/mark><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">YES<\/mark><\/td><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">YES<\/mark><\/td><td><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">GenList<\/mark><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>__limitQ__<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">CodenerixModel<\/mark><\/strong><\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">GenList<\/mark><\/strong><\/strong><\/td><td><strong><strong>Applicable<\/strong><\/strong><\/td><\/tr><\/thead><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">NO<\/mark><\/td><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">NO<\/mark><\/td><td>No filter is applied<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">NO<\/mark><\/td><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">YES<\/mark><\/td><td><strong><strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">GenList<\/mark><\/strong><\/strong><\/strong> filter is applied<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">YES<\/mark><\/td><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">NO<\/mark><\/td><td><strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">CodenerixModel<\/mark><\/strong><\/strong> filter is applied<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">YES<\/mark><\/td><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">YES<\/mark><\/td><td><strong><strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">GenList<\/mark><\/strong><\/strong><\/strong>&nbsp;and <strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">CodenerixModel<\/mark><\/strong><\/strong>&nbsp;filters<br>are applied to put them together<br>with the logic operator \u201c<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">AND<\/mark><\/strong>\u201c.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>__searchQ__ &amp; __searchF__<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">CodenerixModel<\/mark><\/strong><\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">GenList<\/mark><\/strong><\/strong><\/td><td><strong><strong>Applicable<\/strong><\/strong><\/td><\/tr><\/thead><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">NO<\/mark><\/td><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">NO<\/mark><\/td><td>No filter is applied<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">NO<\/mark><\/td><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">YES<\/mark><\/td><td><strong><strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">GenList<\/mark><\/strong><\/strong><\/strong> filter is applied<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">YES<\/mark><\/td><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">NO<\/mark><\/td><td><strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">CodenerixModel<\/mark><\/strong><\/strong> filter is applied<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">YES<\/mark><\/td><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">YES<\/mark><\/td><td><strong><strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">GenList<\/mark><\/strong><\/strong><\/strong> filter is applied <\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>So now we can decide that our view behaves differently from our model. This is done because sometimes we want to create more than one list of the same model where each list has different properties, shows different information depending on the user, or uses a different template.<\/p>\n\n\n\n<p><strong>GenList<\/strong> can also contain different attributes that allow you to configure its operation in many different ways. Here you have a table of what exists today:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Table of attributes allowed by GenList<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th class=\"has-text-align-center\" data-align=\"center\">Attribute<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>annotations<\/strong><\/mark><\/td><td>It is possible to introduce aggregators inside the Querysets used by <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong> (learn more about aggregators in Django). It is very useful when we want it to calculate maximums, minimums, averages, or simply group results by date, types, or other fields. Annotations may also work as a method of the class (see example):<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">annotations = {\n    'min_price': Min('books__price'),\n    'max_price': Max('books__price')\n}\ndef annotations(self, info):\n    anot = []\n    if info.user.is_superuser:\n        anot['min_price'] = Min('books__price')\n        anot['max_price'] = Max('books_price')\n    return anot<\/code><br><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>appname<\/strong><\/mark><\/td><td>Overrides the automatic system to generate URLs so you can set your own app&#8217;s URL. This is commonly used to manage the same model over to different apps (for example several <strong>GenList<\/strong>). Be careful. This field alters the normal behaviour of <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong>, which can confuse you if used wrongly. You can find a fully working example on <a href=\"https:\/\/github.com\/codenerix\/django-codenerix-examples\/tree\/master\/doublegenlist\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>GitHub<\/strong><\/a>.<br><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>autofiltering<\/strong><\/mark><\/td><td>If set to <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">False<\/mark><\/strong>, it disables the automatic filter generation system. By default it is <strong>True<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">autofiltering = False<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">client_context<\/mark><\/strong><\/td><td>It is a dictionary and its content will be sent directly in the <strong>JSON<\/strong> response inside the &#8220;<strong>meta<\/strong>&#8221; structure as &#8220;<strong>context<\/strong>&#8220;. It is very useful to send data directly from the view to the AngularJS controller or template. Usage:<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">client_context = {\"var1\": \"value1\"}<\/code><br><br>The result will be embedded into the &#8220;<strong>meta<\/strong>&#8221; structure:<br><code data-enlighter-language=\"json\" class=\"EnlighterJSRAW\">{\n    \"filter\": ...,\n    \"meta\": {\n            ...\n            \"context\": {\n                \"var1\": \"value1\",\n            },\n            ...\n        },\n    \"table\": ...,\n}<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">default_ordering<\/mark><\/strong><\/td><td>The attribute can be a string or a list of strings. The string may or may not start with \u201c-\u201d. This field indicates the field or fields that are going to be used in the sorting and the symbol \u201c-\u201d indicates that the sorting will be done in descending order (the reverse direction), if nothing is indicated it will be done in ascending order. If a list is given, the ordering will be applied scrupulously following the order in which the fields appear in this list.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">default_ordering = '-name' default_ordering = ['-name', 'date', '-xz']<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>default_rows_per_page<\/strong><\/mark><\/td><td>Used to indicate the number of rows per page that we want to display by default in this list. The standard value used in <strong>GenList<\/strong> is 50.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">default_rows_per_page = 150<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>export<\/strong><\/mark><\/td><td>Force the download of a list as a file. Here is the format. The default is <strong>None<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">export = \"xlsx\"<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>export_excel<\/strong><\/mark><\/td><td>Shows the export to Excel button. By default, it is <strong>True<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">export_excel = False<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>export_name<\/strong><\/mark><\/td><td>Name of the file resulting from the export. By default, it is a \u201c<strong>list<\/strong>\u201c.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">export_name = \"list_file\"<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>extends_base<\/strong><\/mark><\/td><td>It contains the base template path from which the <strong>List<\/strong> template will inherit. It usually goes to a \u201c<strong>base\/base.html<\/strong>\u201c, but by changing this variable, you can tell it to load a different file to offer the user a different environment experience.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">extends_base = \"base\/base.html\"<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>extra_context<\/strong><\/mark><\/td><td>It contains a dictionary that will be mixed with the final context that will be delivered to the render. During the <strong>GenList<\/strong> process, you can override the variables used here.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">extra_context = {\n    \"variable1\": \"This is a CODENERIX variable that will be ready to use in the Template's Context\",\n    \"variable2\": { \"a\": 1, \"b\": 2},\n    \"variable3\": 3.4,\n}<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>field_check<\/strong><\/mark><\/td><td>Activates the display of the <strong>checkbox<\/strong> in the <strong>lists<\/strong>, it is a <strong>checkbox<\/strong> that when checked stores the <strong>pk (primary key) of the row<\/strong> and can be used in the <strong>AngularJS<\/strong>&#8216;s <strong>$scope<\/strong> to do custom operations. This attribute has 3 possible states:<br><br><ul><li><strong>None:<\/strong> the checkbox is not displayed.<\/li><li><strong>False:<\/strong> the checkbox is shown unchecked.<\/li><li><strong>True:<\/strong> the checkbox is shown with everything checked.<\/li><\/ul><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">field_check = True<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>field_delete<\/strong><\/mark><\/td><td>It activates the display of the <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">delete<\/mark><\/strong> field in the lists, it is the icon of a <strong>trash<\/strong> can and when you <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">click<\/mark><\/strong> on it, the user is sent to <strong>delete<\/strong> the said record. By default it is <strong>False<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">field_delete = True<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>haystack<\/strong><\/mark><\/td><td>Activate support for <strong><a href=\"http:\/\/haystacksearch.org\/\">Haystack<\/a><\/strong> in this listing. By default it is <strong>False<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">haystack = True<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>json<\/strong><\/mark><\/td><td>When this attribute is <strong>True<\/strong>, the view will always respond in <strong>JSON<\/strong> format. If the view responds in <strong>JSON<\/strong> format and you want to modify the response, you can work on the view&#8217;s <strong>json_builder() <\/strong>method, rewriting it or simply reprocessing its result. We must know that when the views receive a &#8220;<strong>json<\/strong>&#8221; parameter in <strong>GET\/POST<\/strong>, the <strong>JSON<\/strong> response will <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">automatically be activated<\/mark><\/strong>. This attribute will also be activated when an \u201c<strong>HTTP_X_REST<\/strong>\u201d header is received and its value can be evaluated as a Boolean \u201c<strong>True<\/strong>\u201c. It is important to know that this attribute is set to <strong>Tru<\/strong>e by default.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">json = True<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>linkadd<\/strong><\/mark><\/td><td>Shows the \u201c<strong>Add<\/strong>\u201d button in the listings. By default, it is <strong>True<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">linkadd = False<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>linkedit<\/strong><\/mark><\/td><td>Clicking on a list row goes to the editing mode of that specific record. By default it is <strong>True<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">linkedit = False<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">model<\/mark><\/strong><\/td><td>Model to use.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">model = Contact<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">modelname<\/mark><\/strong><\/td><td>Overrides the automatic system to generate URLs so you can set your own model&#8217;s URL. This is commonly used to manage the same model over different URLs (for example, several <strong>GenList<\/strong>). Be careful, this field alters the normal behaviour of <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong> which can confuse you if used wrongly. You can find a fully working example on <a href=\"https:\/\/github.com\/codenerix\/django-codenerix-examples\/tree\/master\/doublegenlist\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>GitHub<\/strong><\/a>.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">must_be_staff<\/mark><\/strong><\/td><td>Whether or not the user must be staff (ability to see <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\/admin\/<\/mark><\/strong> of <strong>Django<\/strong> according to the User model) to view this list content, its value is <strong>False<\/strong> by default.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">must_be_staff = True<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">must_be_superuser<\/mark><\/strong><\/td><td>Whether or not the user must be a superuser (according to Django&#8217;s User model) in order to view the content of this listing. By default its value is <strong>False<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">must_be_superuser = True<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">ngincludes<\/mark><\/strong><\/td><td>You keep control over possible <strong>ng-includes<\/strong> that may appear in partials.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">ngincludes = {'name':'path_to_partial'}<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">onlybase<\/mark><\/strong><\/td><td>It will cause <strong>GenList<\/strong> to act only as a base file for another view. By default, it is <strong>False<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">onlybase = True<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">permission<\/mark><\/strong><\/td><td>It can be a string or a list of strings. Each string represents one permission. The user can see the list when they have at least one of the permissions in this attribute.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">permission = 'permission1' permission = ['perm1', 'perm2', ...]<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">permission_group<\/mark><\/strong><\/td><td>It can be a string or a list of strings. Each text string represents one group&#8217;s permission. The user will be able to see the list when any of the user&#8217;s groups have any of the permissions that appear in this attribute.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">permission_group = 'permission1'\npermission_group = ['perm1', 'perm2', ...]<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">search_filter_button<\/mark><\/strong><\/td><td>If it is <strong>False<\/strong>, it disables the field filter button. By default it is <strong>True<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">search_filter_button = False<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">show_details<\/mark><\/strong><\/td><td>Clicking on a list row goes to the detail mode of that specific record. By default it is <strong>False<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">show_details = True<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">show_modal<\/mark><\/strong><\/td><td>When on, it pushes the system to render in a modal window.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">show_modal = True<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">static_app_row<\/mark><\/strong><\/td><td>Load the AngularJS application file indicated here, otherwise use the default: <strong>codenerix\/js\/apps.js<\/strong><br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">static_app_row = \"app\/models_apps.js\"<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">static_controllers_row<\/mark><\/strong><\/td><td>It loads the AngularJS controller file indicated here. Otherwise, it does not load any.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">static_controllers_row = \"app\/models_controllers.js\"<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">static_filters_row<\/mark><\/strong><\/td><td>Load the AngularJS filter file indicated here, otherwise use the default one: <strong>codenerix\/js\/rows.js<\/strong><br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">static_filters_row = \"app\/models_rows.js\"<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">static_partial_header<\/mark><\/strong><\/td><td>Causes the indicated table &#8220;header partial&#8221; to be loaded, if not specified there will be no header partial.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">static_partial_header = \"app\/models_header.html\"<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">static_partial_row<\/mark><\/strong><\/td><td>Causes the row partial specified in this attribute to be loaded instead of the default partial: <strong>codenerix\/partials\/rows.html<\/strong><br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">static_partial_row = \"app\/models_rows.html\"<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">static_partial_summary<\/mark><\/strong><\/td><td>Causes the &#8220;tail partial&#8221; of the table specified in this attribute to be loaded instead of the default partial: codenerix\/partials\/summary.html<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">static_partial_summary = \"app\/models_summary.html\"<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">template_base<\/mark><\/strong><\/td><td>It is the template that acts as a base for the rest. <strong>GenList<\/strong> generally renders through a series of templates that jump from one to another by inheritance. In the last step, the <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong> templates call a base template that is usually \u201c<strong>base\/base<\/strong>\u201d, however, this can be changed with this attribute so that it uses another base template. Remember that <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong> will try to locate the rest of the name of the \u201cweb\u201d file using the template detection algorithms.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">template_base = 'frontend\/web'<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">template_base_ext<\/mark><\/strong><\/td><td>Extension used for <strong>template_base<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">template_base_ext = 'html'<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">template_model<\/mark><\/strong><\/td><td>This is the template used as the entry point for the <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong> renderer. Generally, if the path doesn&#8217;t exist it will end up using \u201c<strong>codenerix\/list<\/strong>\u201d (which will end up being \u201c<strong>codenerix\/list.html<\/strong>\u201d) however it is possible to define our own entry point using this attribute. This is very useful when we want to add \u201c<strong>extra_css<\/strong>\u201d or \u201c<strong>extra_js<\/strong>\u201d in the rendering, and our base template supports these blocks.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">template_model = 'app\/contact_list'<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">template_model_ext<\/mark><\/strong><\/td><td>Extension used for <strong>template_model<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">template_model_ext = 'html'<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">user<\/mark><\/strong><\/td><td>Allows you to make a view behave specifically as a specific user. It is very useful when you want to view the list as if you were another user of the system. It&#8217;s a <strong>Django<\/strong> <strong>User<\/strong> object that will be used by all processes in the view and passed to all methods that request it.<br><br><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>IMPORTANT: the permissions management system is not affected by this variable. That is, it will continue to receive the user who has requested to view the list, and the access restriction policies will be applied to this user, not to the one that appears in this attribute.<\/strong><\/mark><br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">user = User.objects.filter(is_superadmin=False).first()<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">vtable<\/mark><\/strong><\/td><td><strong>VTable<\/strong> is a technology by which the list becomes non-paged and <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong> does a proactive job to estimate the real width of the list on screen and virtualizes the environment in such a way that it preloads a few pages in the browser but not all and adjusts the scroll the same as it would be if all the records were loaded this way when we move in the list <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong> loads new pages and unloads old ones to allow the browser to work at an adequate rendering speed, but the user perceives the sensation of being working on a huge list and that all the records are there. This functionality is experimental because it has not been tested enough. By default this attribute is <strong>False<\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">vtable = True<\/code><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">ws_entry_point<\/mark><\/strong><\/td><td>This attribute defines the route to the entry point for the operations that the list wants to carry out, for example, when loading the list, the route indicated by the \u201cws_entry_point\u201d is used, and when editing its use is repeated. It is generally used in extra views that are added on top of an existing one on the model and when you want to introduce a new Angular controller or something else that modifies the standard behaviour of <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong>.<br><br><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">ws_entry_point = \"planner\/plane\"<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>In addition to these attributes, we must know how <strong>GenList<\/strong> tries to locate the templates for rendering the page. <strong>GenList<\/strong> will try to build a series of URLs based on the user&#8217;s profile and language so that if the user is superadmin he will have an &#8220;<strong>admin<\/strong>&#8221; profile, and otherwise, he will not have any profile. The user&#8217;s language is detected by <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong> and will also be delivered to the template detection function.<\/p>\n\n\n\n<p>The possible routes for the templates will be (following this order of priority):<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;path&gt;\/&lt;file&gt;<\/mark>.admin.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">&lt;language&gt;<\/mark>.html<\/strong><\/li>\n\n\n\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;path&gt;\/&lt;file&gt;<\/mark>.admin.html<\/strong><\/li>\n\n\n\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;path&gt;\/&lt;file&gt;<\/mark>.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">&lt;username&gt;<\/mark>.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">&lt;language&gt;<\/mark>.html<\/strong><\/li>\n\n\n\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;path&gt;\/&lt;file&gt;<\/mark>.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">&lt;username&gt;<\/mark>.html<\/strong><\/li>\n\n\n\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;path&gt;\/&lt;file&gt;<\/mark>.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">&lt;language&gt;<\/mark>.html<\/strong><\/li>\n\n\n\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;path&gt;\/&lt;file&gt;<\/mark>.html<\/strong><\/li>\n<\/ol>\n\n\n\n<p>In this way, if the user is &#8220;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"><strong>peter<\/strong><\/mark>&#8220;, <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\"><strong>he is a superuser,<\/strong><\/mark> and his language at the time of the query is <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">English<\/mark><\/strong> with code &#8220;<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">en<\/mark><\/strong>&#8220;, and the path to the file is &#8220;<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">base\/home<\/mark><\/strong>&#8220;, the system will test the existence of the following files:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">base\/home<\/mark>.admin.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">en<\/mark>.html<\/strong><\/li>\n\n\n\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">base\/home<\/mark>.admin.html<\/strong><\/li>\n\n\n\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">base\/home<\/mark>.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">peter<\/mark>.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">en<\/mark>.html<\/strong><\/li>\n\n\n\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">base\/home<\/mark>.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">peter<\/mark>.html<\/strong><\/li>\n\n\n\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">base\/home<\/mark>.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">en<\/mark>.html<\/strong><\/li>\n\n\n\n<li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">base\/home<\/mark>.html<\/strong><\/li>\n<\/ol>\n\n\n\n<p><strong>GenList<\/strong> also supports automatically detecting static files for loading partials and <strong>AngularJS<\/strong> files such as application files, controllers, or filters. To do this, <strong>GenList<\/strong> will try to locate these files in the application folder inside &#8220;<strong>\/static<\/strong>&#8221; (or whatever the path of static files on disk is according to the <strong>STATIC_ROOT<\/strong> constant in <strong>Django<\/strong>&#8216;s <strong>settings<\/strong>). For this detection, it will use the same algorithm that template detection uses. In this way, it will test for each static file the possible existence of this on disk and will load these instead of those that exist by default in <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong>. To generate the routes, the system will use the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>The path:<\/strong> it will be the path of the static files, the name of the APP where the model is located, and the name of the model ending in &#8220;<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">s<\/mark><\/strong>&#8220;.<\/li>\n\n\n\n<li><strong>File type:<\/strong> it can be:\n<ul class=\"wp-block-list\">\n<li><strong>&lt;none&gt;:<\/strong> for the partial that declares the filters to display above the listing table, and generally to include the table with <strong>nginclude<\/strong>.<\/li>\n\n\n\n<li><strong>rows:<\/strong> for the partial of the rows<\/li>\n\n\n\n<li><strong>header:<\/strong> for the partial of the table header (below the declaration of the columns and above the rows).<\/li>\n\n\n\n<li><strong>summary:<\/strong> for the footer partial of the table (below the rows and above the closing table tags).<\/li>\n\n\n\n<li><strong>app:<\/strong> for application files.<\/li>\n\n\n\n<li><strong>controllers:<\/strong> for the controllers.<\/li>\n\n\n\n<li><strong>filters:<\/strong> for AngularJS filter files.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>The extension:<\/strong> will be that of each type of file:\n<ul class=\"wp-block-list\">\n<li><strong>html:<\/strong> for partials<\/li>\n\n\n\n<li><strong>js:<\/strong> for the rest<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>The final result will be from the concatenation of the following:\n<ul class=\"wp-block-list\">\n<li>The route<\/li>\n\n\n\n<li>&#8220;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>_<\/strong><\/mark>&#8221; plus file type<\/li>\n\n\n\n<li>The extension.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>For an app called &#8220;<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">base<\/mark><\/strong>&#8220;, with a model called &#8220;<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">Contact<\/mark><\/strong>&#8220;, to obtain the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>partial rows <\/strong><\/mark>of a user &#8220;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"><strong>peter<\/strong><\/mark>&#8220;, who <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">is a superuser<\/mark><\/strong> and visits the site in <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\"><strong>English<\/strong><\/mark>, the system would try the following routes:\n<ul class=\"wp-block-list\">\n<li><strong>static\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">base<\/mark>\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">contact<\/mark>s_<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">rows<\/mark>.admin.<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">en<\/mark><\/strong>.html<\/strong><\/li>\n\n\n\n<li><strong>static\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">base<\/mark>\/<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">contact<\/mark>s_<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">rows<\/mark><\/strong>.admin.html<\/strong><\/li>\n\n\n\n<li><strong>static\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">base<\/mark>\/<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">contact<\/mark>s_<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">rows<\/mark><\/strong>.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">peter<\/mark>.<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">en<\/mark><\/strong>.html<\/strong><\/li>\n\n\n\n<li><strong>static\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">base<\/mark>\/<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">contact<\/mark>s_<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">rows<\/mark><\/strong>.<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">peter<\/mark><\/strong>.html<\/strong><\/li>\n\n\n\n<li><strong>static\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">base<\/mark>\/<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">contact<\/mark>s_<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">rows<\/mark><\/strong>.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">en<\/mark>.html<\/strong><\/li>\n\n\n\n<li><strong>static\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">base<\/mark>\/<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">contact<\/mark>s_<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">rows<\/mark><\/strong>.html<\/strong><\/li>\n\n\n\n<li><strong>static\/codenerix\/partials\/rows.html (if the above fails)<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p><br>Finally, we must talk about the <strong>json_builder()<\/strong> method since it is a GenList method that allows you to control the result that will be offered to the user. The method is defined with 2 parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>answer:<\/strong> contains the answer pre-calculated by <strong>GenList<\/strong>, which only lacks the &#8220;<strong>body<\/strong>&#8221; that should be placed in <strong>answer[&#8220;table&#8221;][&#8220;body&#8221;]<\/strong><\/li>\n\n\n\n<li><strong>context:<\/strong> contains the <strong>context<\/strong> available for rendering the JSON generator in this case. Within the context is the &#8220;object_list&#8221; containing the QuerySet resulting from applying the <strong>filters<\/strong> and what <strong>GenList<\/strong> should theoretically respond to.<\/li>\n<\/ul>\n\n\n\n<p>There are 3 techniques to work with<strong> json_builder()<\/strong>:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Technique 1:<\/strong> &#8220;Body building on your own&#8221;<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>You build the entire body<\/strong> of the answer yourself:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def json_builder(self,answer,context):\n    # The body is a list of records (body or body of the list)\n    body=[]\n\n    # Process each element of the context's object_list in order to process all rows\n    for or in context['object_list']:\n        t={}\n        t['name']=o.name\n        t['surname']=o.surname\n        phones=[]\n        for o2 in o.phone.all():\n            phone={}\n            phone['country']=o2.country\n            phone['prefix']=o2.prefix\n            phone['number']=o2.number\n            phones.append(t2)\n        t['phone']=phones\n        t['address']=o.address\n        body.append(t)\n\n    # Insert the body into the response body\n    answer['table']['body']=body\n\n    # Returns the ready response\n    return answer<\/pre>\n\n\n\n<p>In this example, we build a list manually where we are responsible for filling each row or record of the body. When we finish processing the rows that we want to send to the user&#8217;s browser, we load these rows (list) in the response and return them.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading has-text-align-left\"><strong>Technique 2: <\/strong>&#8220;Body building with bodybuilder()&#8221;<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<p>Use the <strong>bodybuilder() method<\/strong> to help you build the body of the response:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def json_builder(self,answer,context):\n    # We fill directly using bodybuilder\n    answer['table']['body']=self.bodybuilder(context['object_list'],{\n        'id:user__register__id':None,\n        'name': None,\n        'surname':None,\n        phone: {\n            'country':None,\n            'prefix':None,\n            'number':None,\n            },\n        'address':None,\n        })\n\n    # Answer the new context\n    return answer<\/pre>\n\n\n\n<p>When <strong>bodybuilder()<\/strong> is used, it expects to receive the list of objects to process and the form of the records it should build. What bodybuilder() does is that for each record of the object_list it generates an entry in the body, where each of those entries is dictionaries that have the form of the second parameter of the call, in this way each record of this example would have 5 keys in the dictionary:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>id:<\/strong> would be the result of extracting the &#8220;<strong>user<\/strong>&#8221; field from the object and thus the &#8220;register&#8221; field and, from this, the &#8220;id&#8221; field. If &#8220;id:\u2026&#8221; was not specified as an alias, the key would contain the full path, which would be &#8220;<strong>user__register__id<\/strong>&#8220;.<\/li>\n\n\n\n<li><strong>name:<\/strong> the result of extracting the <strong>name<\/strong> field from the object or the result of calling the <strong>name() <\/strong>method.<\/li>\n\n\n\n<li><strong>surname:<\/strong> the result of extracting the <strong>surname<\/strong> field from the object or the result of calling the<strong> surname() <\/strong>method.<\/li>\n\n\n\n<li><strong>phone:<\/strong> it will be a dictionary with 3 keys:\n<ul class=\"wp-block-list\">\n<li><strong>country:<\/strong> the result of extracting the <strong>phone<\/strong> field from the object, and from it the country field or the result of calling the <strong>country() <\/strong>method.<\/li>\n\n\n\n<li><strong>prefix:<\/strong> the result of extracting the <strong>phone<\/strong> field from the object, and from it the <strong>prefix<\/strong> field or the result of calling the <strong>prefix() <\/strong>method.<\/li>\n\n\n\n<li><strong>number:<\/strong> the result of extracting the <strong>phone<\/strong> field from the object, and from this the <strong>number<\/strong> field or the result of calling the <strong>number()<\/strong> method.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>address:<\/strong> the result of extracting the <strong>address<\/strong> field from the object or the result of calling the <strong>address()<\/strong> method.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Technique 3: <\/strong>&#8220;Body building with autorules() and bodybuilder()&#8221;<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<p>Where you use <strong>autorules() and bodybuilder()<\/strong> to build the response:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def json_builder(self,answer,context):\n    # Request the rules to autorules\n    rules=self.autorules()\n    # Get one of the keys from autorules (field we don't want in the response)\n    rules.pop('id')\n    # Add another key (field we want in the response, in this case an alias of user->id)\n    rules['id:user__id']=None\n    # Call bodybuilder the new set of rules\n    answer['table']['body']=self.bodybuilder(context['object_list'],rules)\n\n    # return the result\n    return answer<\/pre>\n\n\n\n<p>In this case, we ask <strong>GenList<\/strong> for the rules we should use. We adopt that set of rules as we wish and deliver it to <strong>bodybuilder()<\/strong> so that it finishes the job of generating the response body.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Notes on the query optimizer<\/h2>\n\n\n\n<p>We must consider that GenList includes a query optimizer to reduce the work done in Python and pass part of it to the database manager. This optimizer does not work when data is involved in the result that the database cannot compute on its own, that is, generally, when methods are included in the results and they are not purely data stored in the objects.<\/p>\n\n\n\n<p>Another important detail is that the optimizer converts the result rows into dictionary objects so that it only contains the data as-is and does not instantiate the model objects as would be normal in Django.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Custom QuerySet or customized QuerySet<\/h2>\n\n\n\n<p>Finally, when we <strong>cannot<\/strong> work with the filters or when introducing certain limitations (annotates for example) the result no longer works as we wish\u2026.we will always have an &#8220;<strong>ACE up our sleeve<\/strong>&#8220;, the method &#8220;<strong>custom_queryset(queryset, info)&#8221;<\/strong>. This method must be rewritten in your view in order for <strong><span style=\"color: #343433;\"><strong><a href=\"https:\/\/github.com\/codenerix\/django-codenerix\"><span style=\"color: #343433;\">CODE<\/span><span style=\"color: #70a8e0;\">NERIX<\/span><\/a><\/strong><\/span><\/strong> to use it since. Otherwise, it will operate normally. This method receives two parameters: the first is the QuerySet calculated by GenList, and the second is the MODELINF object that contains internal information about the query, the model, arguments, etc\u2026 and expects you to return a valid QuerySet. This is why you can return the QuerySet you received with a few more parameters taking advantage of the power of Django&#8217;s ORM, or it could even be a <strong>QuerySet<\/strong> from a different model.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83c\uddea\ud83c\udde6&nbsp;Leer en Espa\u00f1ol, \u201cGenList\u201c Previously we talked about CodenerixModel to understand how a functional model is built with CODENERIX; however, for everything to work in Django, in addition to models you also have to define views. To allow web content to be viewed, a set of inheritable views is available to the programmer, all based [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":665,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[20],"tags":[],"class_list":["post-664","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howto"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>GenList - Codenerix<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codenerix.com\/en\/genlist\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GenList - Codenerix\" \/>\n<meta property=\"og:description\" content=\"\ud83c\uddea\ud83c\udde6&nbsp;Leer en Espa\u00f1ol, \u201cGenList\u201c Previously we talked about CodenerixModel to understand how a functional model is built with CODENERIX; however, for everything to work in Django, in addition to models you also have to define views. To allow web content to be viewed, a set of inheritable views is available to the programmer, all based [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codenerix.com\/en\/genlist\/\" \/>\n<meta property=\"og:site_name\" content=\"Codenerix\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-22T20:13:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-06T06:57:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1093\" \/>\n\t<meta property=\"og:image:height\" content=\"542\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Codenerix\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Codenerix\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"17 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codenerix.com\/en\/genlist\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codenerix.com\/en\/genlist\/\"},\"author\":{\"name\":\"Codenerix\",\"@id\":\"https:\/\/codenerix.com\/#\/schema\/person\/c1dce0f30541a2be119ee8adc332a9af\"},\"headline\":\"GenList\",\"datePublished\":\"2018-03-22T20:13:00+00:00\",\"dateModified\":\"2023-04-06T06:57:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codenerix.com\/en\/genlist\/\"},\"wordCount\":3442,\"image\":{\"@id\":\"https:\/\/codenerix.com\/en\/genlist\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list.png\",\"articleSection\":[\"Howto\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codenerix.com\/en\/genlist\/\",\"url\":\"https:\/\/codenerix.com\/en\/genlist\/\",\"name\":\"GenList - Codenerix\",\"isPartOf\":{\"@id\":\"https:\/\/codenerix.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codenerix.com\/en\/genlist\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codenerix.com\/en\/genlist\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list.png\",\"datePublished\":\"2018-03-22T20:13:00+00:00\",\"dateModified\":\"2023-04-06T06:57:42+00:00\",\"author\":{\"@id\":\"https:\/\/codenerix.com\/#\/schema\/person\/c1dce0f30541a2be119ee8adc332a9af\"},\"breadcrumb\":{\"@id\":\"https:\/\/codenerix.com\/en\/genlist\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codenerix.com\/en\/genlist\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codenerix.com\/en\/genlist\/#primaryimage\",\"url\":\"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list.png\",\"contentUrl\":\"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list.png\",\"width\":1093,\"height\":542},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codenerix.com\/en\/genlist\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codenerix.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GenList\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codenerix.com\/#website\",\"url\":\"https:\/\/codenerix.com\/\",\"name\":\"Codenerix\",\"description\":\"Framework libre Open Source\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codenerix.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/codenerix.com\/#\/schema\/person\/c1dce0f30541a2be119ee8adc332a9af\",\"name\":\"Codenerix\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codenerix.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/dee2772994eb5d89e57afac281bca674800da15c6c32fba528dea162570d644d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/dee2772994eb5d89e57afac281bca674800da15c6c32fba528dea162570d644d?s=96&d=mm&r=g\",\"caption\":\"Codenerix\"},\"url\":\"https:\/\/codenerix.com\/en\/author\/codenerix\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"GenList - Codenerix","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codenerix.com\/en\/genlist\/","og_locale":"en_US","og_type":"article","og_title":"GenList - Codenerix","og_description":"\ud83c\uddea\ud83c\udde6&nbsp;Leer en Espa\u00f1ol, \u201cGenList\u201c Previously we talked about CodenerixModel to understand how a functional model is built with CODENERIX; however, for everything to work in Django, in addition to models you also have to define views. To allow web content to be viewed, a set of inheritable views is available to the programmer, all based [&hellip;]","og_url":"https:\/\/codenerix.com\/en\/genlist\/","og_site_name":"Codenerix","article_published_time":"2018-03-22T20:13:00+00:00","article_modified_time":"2023-04-06T06:57:42+00:00","og_image":[{"width":1093,"height":542,"url":"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list.png","type":"image\/png"}],"author":"Codenerix","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Codenerix","Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codenerix.com\/en\/genlist\/#article","isPartOf":{"@id":"https:\/\/codenerix.com\/en\/genlist\/"},"author":{"name":"Codenerix","@id":"https:\/\/codenerix.com\/#\/schema\/person\/c1dce0f30541a2be119ee8adc332a9af"},"headline":"GenList","datePublished":"2018-03-22T20:13:00+00:00","dateModified":"2023-04-06T06:57:42+00:00","mainEntityOfPage":{"@id":"https:\/\/codenerix.com\/en\/genlist\/"},"wordCount":3442,"image":{"@id":"https:\/\/codenerix.com\/en\/genlist\/#primaryimage"},"thumbnailUrl":"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list.png","articleSection":["Howto"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/codenerix.com\/en\/genlist\/","url":"https:\/\/codenerix.com\/en\/genlist\/","name":"GenList - Codenerix","isPartOf":{"@id":"https:\/\/codenerix.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codenerix.com\/en\/genlist\/#primaryimage"},"image":{"@id":"https:\/\/codenerix.com\/en\/genlist\/#primaryimage"},"thumbnailUrl":"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list.png","datePublished":"2018-03-22T20:13:00+00:00","dateModified":"2023-04-06T06:57:42+00:00","author":{"@id":"https:\/\/codenerix.com\/#\/schema\/person\/c1dce0f30541a2be119ee8adc332a9af"},"breadcrumb":{"@id":"https:\/\/codenerix.com\/en\/genlist\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codenerix.com\/en\/genlist\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codenerix.com\/en\/genlist\/#primaryimage","url":"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list.png","contentUrl":"https:\/\/codenerix.com\/wp-content\/uploads\/2022\/06\/codenerix_genlist_contact_list.png","width":1093,"height":542},{"@type":"BreadcrumbList","@id":"https:\/\/codenerix.com\/en\/genlist\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codenerix.com\/en\/"},{"@type":"ListItem","position":2,"name":"GenList"}]},{"@type":"WebSite","@id":"https:\/\/codenerix.com\/#website","url":"https:\/\/codenerix.com\/","name":"Codenerix","description":"Framework libre Open Source","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codenerix.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/codenerix.com\/#\/schema\/person\/c1dce0f30541a2be119ee8adc332a9af","name":"Codenerix","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codenerix.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/dee2772994eb5d89e57afac281bca674800da15c6c32fba528dea162570d644d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dee2772994eb5d89e57afac281bca674800da15c6c32fba528dea162570d644d?s=96&d=mm&r=g","caption":"Codenerix"},"url":"https:\/\/codenerix.com\/en\/author\/codenerix\/"}]}},"_links":{"self":[{"href":"https:\/\/codenerix.com\/en\/wp-json\/wp\/v2\/posts\/664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codenerix.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codenerix.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codenerix.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/codenerix.com\/en\/wp-json\/wp\/v2\/comments?post=664"}],"version-history":[{"count":52,"href":"https:\/\/codenerix.com\/en\/wp-json\/wp\/v2\/posts\/664\/revisions"}],"predecessor-version":[{"id":875,"href":"https:\/\/codenerix.com\/en\/wp-json\/wp\/v2\/posts\/664\/revisions\/875"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codenerix.com\/en\/wp-json\/wp\/v2\/media\/665"}],"wp:attachment":[{"href":"https:\/\/codenerix.com\/en\/wp-json\/wp\/v2\/media?parent=664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codenerix.com\/en\/wp-json\/wp\/v2\/categories?post=664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codenerix.com\/en\/wp-json\/wp\/v2\/tags?post=664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}