These are chat archives for django/django

Sep 2018
Harry Moreno
Sep 12 2018 00:45 UTC
is it possible to use the default django.contrib.sessions and django.contrib.auth without templates? i.e. speaking json over http by a phone app
Sep 12 2018 02:34 UTC
Hello group, i'm back xd:
a question, somebody knows how to join template tag 'default' with an 'include' ?
something like this:
{{ tableWithRecords|default:|add: {% include 'emptyTable.html' %} }}
Sep 12 2018 07:57 UTC
Hallo! How to render template in context?
def get_context_data(self, **kwargs):
    context = super().get_context_data(**kwargs)
    context['currency'] = render(self.request, 'front/default/common/home.jinja', {})
    return context
<HttpResponse status_code=200, "text/html; charset=utf-8">
Sep 12 2018 13:38 UTC
Can anyone help me at this, please? It's regarding model design.

I want to mimic the behavior as in this website

where when i select the industry that is in Business Model section, the segment should get updated accordingly.

Shashank Parekh
Sep 12 2018 16:28 UTC
You can have three model, Industry, Segment and IndustrySegmentMapping.
Sep 12 2018 16:35 UTC
Can you show me a sample, please?
mapping part
Shashank Parekh
Sep 12 2018 17:04 UTC
class Industry(models.Model):
    name = models.CharField(max_length=150, blank=True, null=True)

class Segment(models.Model):
    name = models.CharField(max_length=150, blank=True, null=True)

class Mapping(models.Model):
     industry = models.ForeignKey(Industry)
     segment = models.ForeignKey(Segment)
Hammour ihab
Sep 12 2018 22:40 UTC
Damn I'm soo tired
Sep 12 2018 23:55 UTC
Thanks @sp1rs . I have one question still. Mapping should be a foreign key in BusinessModel table instead of separate Industry and Segment table?