These are chat archives for django/django

Oct 2018
Tanveer Ahmed
Oct 03 2018 10:25
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
Brady Hurlburt
Oct 03 2018 13:21
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.
Oct 03 2018 13:42
any graphql guy here?
Brady Hurlburt
Oct 03 2018 13:51
Hey, I found an example of mocking out the channel layer for testing!
Oct 03 2018 14:18
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'))
        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:
   = 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>,)\": \"\" must be a \"Company\" instance. error?