Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
dj-kaos-utils / models / utils.py
Size: Mime:
from django.core.exceptions import ObjectDoesNotExist
from django.db import models


def check_fk_exists(instance: models.Model, fk_field_name: str):
    try:
        return getattr(instance, fk_field_name)
    except ObjectDoesNotExist:
        return None