These are chat archives for django/django

Oct 2018
Francisco Benavides
Oct 12 2018 04:32
Hello everyone, I am integrating a Python/Django backend with a JavaScript/React frontend, and doing it with Webpack, yet I am a newbie in Webpack and the examples and tutorials are not up to date to the latest stable releases. I have read the documentation and it is painfully slow for me to grasp all the knowhow and translate into a working solution. Does anyone know of a working example that I could use? Suggestions? Recommendations? Thank you!
Oct 12 2018 08:55
@fbenavides69 i'm using django and react and connect them over graphql.
I would suggest the howtographql site. Choose the relevant tutorial at the bottom of the page ;)
Also django-graphene work like a charm.
if your not sure where to start with webpack and all the build tools, go for createreactapp
Oct 12 2018 13:01
@LukeVideo this line gives me a instance company_instance = get_instance(models.Company, id)because my get_instance helper function is like following
def get_instance(_object, encoded_id, otherwise=None):
        return _object.objects.get(pk=from_global_id(encoded_id)[1])
    except _object.DoesNotExist:
        return otherwise
Oct 12 2018 14:26
@LukeVideo there is very silly mistake i have done, if you notice it. = company,
There is comma after each statement which is making it as tuple
Oct 12 2018 14:32
Classic !
Dominik Matta
Oct 12 2018 15:07
Hey guys!
How do you deal with sth like this:
author = models.Author(name='Herp Derp')
book = models.Book(name='Super book', author=author)  # author saved after new book creation => book.author_id remains empty :/
book.author_id =  # <-- is there any other way to do this automatically before save?
# =  <-- this works, too
Dominik Matta
Oct 12 2018 15:34
Documented here:
Looks like this won't fix
If you want your own solution:
Oct 12 2018 18:40
I'm wondering why you're not creating a BaseClass of 'Literature' which would include all info on books and authors, and then create author and book models that inherit from that.
Corey Vincent
Oct 12 2018 20:07
can anyone help me with haystack search?
Or search in general?
Eze Sunday
Oct 12 2018 21:49
Hello, guys. I was wondering how embedding works. I mean how I can take a javascript code from drift. Embed it into my website and I'll start seeing a chat widget on my website. Anyone with an idea? I'm trying to understand this concept. I really don't know the right keywords to search on Google right now. I'm creating something that should work that way.