These are chat archives for django/django

3rd
Oct 2018
Tanveer Ahmed
@tanveerobjects_twitter
Oct 03 2018 10:25 UTC
Hi Everyone, Need help and suggestion I have two apps in mysite Portfolio & Blog I want to display some List Items from both app on HomePage How can I do this is it good way to register templatetags or need to write view in mysite views.py?
Brady Hurlburt
@aninternetof
Oct 03 2018 13:21 UTC
Hi folks! Is it ok if I ask a django-channels question on here? There are more people here than in their IRC room.
I've been reading the django-channels channel-layer and testing docs. Is there a dummy/mock channel-layer I can use in my test environment? I'd like to write unit tests for my consumers' group behavior, but I don't want to have to run redis to run the tests.
MilanRgm
@MilanRgm
Oct 03 2018 13:42 UTC
any graphql guy here?
Brady Hurlburt
@aninternetof
Oct 03 2018 13:51 UTC
Hey, I found an example of mocking out the channel layer for testing! https://github.com/django/channels/blob/master/tests/test_generic_websocket.py#L87
MilanRgm
@MilanRgm
Oct 03 2018 14:18 UTC
def mutate(root, info, **args):
    print('args', args)
    if not info.context.user.is_authenticated:
        return UpdateBusinessModel(errors=json.dumps('Please Login to list your brand'))
    try:
        business_model_instance = get_instance(models.BusinessModel, args.get('id'))
        company = models.Company.objects.get(slug=args.get('input')['company'])
        industry = models.Industry.objects.get(slug=args.get('input')['industry'])
        print("company", company, business_model_instance)
        segment = models.Segment.objects.get(slug=args.get('input')['segments'])
        if business_model_instance and company and industry:
            business_model_instance.company = company,
            business_model_instance.industry = industry,
            business_model_instance.segments = segment,
            business_model_instance.total_investment = args.get('input')['total_investment'],
            business_model_instance.franchise_fee = args.get('input')['franchise_fee'],
            business_model_instance.is_refundable = args.get('input')['is_refundable'],
            return UpdateBusinessModel(business_model=business_model_instance, errors=None)
    except (models.BusinessModel.DoesNotExist, models.Company.DoesNotExist, models.Industry.DoesNotExist, models.Segment.DoesNotExist):
        return UpdateBusinessModel(errors=json.dumps('Company should be required'))
here why do i get Cannot assign \"(<Company: Waft Company>,)\": \"BusinessModel.company\" must be a \"Company\" instance. error?