These are chat archives for django/django

12th
Sep 2018
Harry Moreno
@morenoh149
Sep 12 2018 00:45
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
AlejandroMendez
@AlejandroMendez
Sep 12 2018 02:34
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' %} }}
soulilya
@soulilya
Sep 12 2018 07:57
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">
MilanRgm
@MilanRgm
Sep 12 2018 13:38
Can anyone help me at this, please? It's regarding model design.

I want to mimic the behavior as in this website https://www.franchisebazar.com/franchisor-registration

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

Shashank Parekh
@sp1rs
Sep 12 2018 16:28
You can have three model, Industry, Segment and IndustrySegmentMapping.
MilanRgm
@MilanRgm
Sep 12 2018 16:35
Can you show me a sample, please?
mapping part
Shashank Parekh
@sp1rs
Sep 12 2018 17:04
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
@hammourihab
Sep 12 2018 22:40
Damn I'm soo tired
MilanRgm
@MilanRgm
Sep 12 2018 23:55
Thanks @sp1rs . I have one question still. Mapping should be a foreign key in BusinessModel table instead of separate Industry and Segment table?