from django import template
from ..generate import image_url as url


register = template.Library()


@register.simple_tag
def image_url(image_url, **kwargs):
    return url(image_url=image_url, **kwargs)


@register.simple_tag
def image_obj(image, **kwargs):
    new = {}
    new['flip'] = image.flip
    new['flop'] = image.flop
    if image.halign:
        new['halign'] = image.halign
    if image.valign:
        new['valign'] = image.valign
    new['fit_in'] = image.fit_in
    new['smart'] = image.smart

    kwargs = dict(new, **kwargs)
    return url(image_url=image.image.url, **kwargs)

from django import template
from ..generate import image_url as url


register = template.Library()


@register.simple_tag
def image_url(image_url, **kwargs):
    return url(image_url=image_url, **kwargs)


@register.simple_tag
def image_obj(image, **kwargs):
    new = {}
    if getattr(image, 'flip'):
        new['flip'] = image.flip
    if getattr(image, 'flop'):
        new['flop'] = image.flop
    if getattr(image, 'halign'):
        new['halign'] = image.halign
    if getattr(image, 'valign'):
        new['valign'] = image.valign
    if getattr(image, 'fit_in'):
        new['fit_in'] = image.fit_in
    if getattr(image, 'smart'):
        new['smart'] = image.smart

    kwargs = dict(new, **kwargs)
    return url(image_url=image.image.url, **kwargs)

Fix has no attribute on templatetags image_obj
Fix has no attribute on templatetags image_obj

  from django import template
  from ..generate import image_url as url
  
  
  register = template.Library()
  
  
  @register.simple_tag
  def image_url(image_url, **kwargs):
      return url(image_url=image_url, **kwargs)
  
  
  @register.simple_tag
  def image_obj(image, **kwargs):
      new = {}
+     if getattr(image, 'flip'):
-     new['flip'] = image.flip
+         new['flip'] = image.flip
+     if getattr(image, 'flop'):
-     new['flop'] = image.flop
+         new['flop'] = image.flop
-     if image.halign:
+     if getattr(image, 'halign'):
          new['halign'] = image.halign
-     if image.valign:
+     if getattr(image, 'valign'):
          new['valign'] = image.valign
+     if getattr(image, 'fit_in'):
-     new['fit_in'] = image.fit_in
+         new['fit_in'] = image.fit_in
+     if getattr(image, 'smart'):
-     new['smart'] = image.smart
+         new['smart'] = image.smart
  
      kwargs = dict(new, **kwargs)
      return url(image_url=image.image.url, **kwargs)
  
Fix has no attribute on templatetags image_obj
## Code Before:
from django import template
from ..generate import image_url as url


register = template.Library()


@register.simple_tag
def image_url(image_url, **kwargs):
    return url(image_url=image_url, **kwargs)


@register.simple_tag
def image_obj(image, **kwargs):
    new = {}
    new['flip'] = image.flip
    new['flop'] = image.flop
    if image.halign:
        new['halign'] = image.halign
    if image.valign:
        new['valign'] = image.valign
    new['fit_in'] = image.fit_in
    new['smart'] = image.smart

    kwargs = dict(new, **kwargs)
    return url(image_url=image.image.url, **kwargs)

## Instruction:
Fix has no attribute on templatetags image_obj
## Code After:
from django import template
from ..generate import image_url as url


register = template.Library()


@register.simple_tag
def image_url(image_url, **kwargs):
    return url(image_url=image_url, **kwargs)


@register.simple_tag
def image_obj(image, **kwargs):
    new = {}
    if getattr(image, 'flip'):
        new['flip'] = image.flip
    if getattr(image, 'flop'):
        new['flop'] = image.flop
    if getattr(image, 'halign'):
        new['halign'] = image.halign
    if getattr(image, 'valign'):
        new['valign'] = image.valign
    if getattr(image, 'fit_in'):
        new['fit_in'] = image.fit_in
    if getattr(image, 'smart'):
        new['smart'] = image.smart

    kwargs = dict(new, **kwargs)
    return url(image_url=image.image.url, **kwargs)
