from datetime import datetime
from os.path import splitext
from django.core.exceptions import ValidationError


def get_timestamp_path(instance, filename):
    ext = splitext(filename)[-1]
    if ext in ('.png', '.jpg'):
        return f'{datetime.now().timestamp()}{ext}'
    else:
        raise ValidationError('Image is not .png or .jpg')

7a98bb283ff60dc6140e450ce6c5f807544f1788
<mask token>

<mask token>


def get_timestamp_path(instance, filename):
    ext = splitext(filename)[-1]
    if ext in ('.png', '.jpg'):
        return f'{datetime.now().timestamp()}{ext}'
    else:
        raise ValidationError('Image is not .png or .jpg')

from datetime import datetime
from os.path import splitext
from django.core.exceptions import ValidationError


def get_timestamp_path(instance, filename):
    ext = splitext(filename)[-1]
    if ext in ('.png', '.jpg'):
        return f'{datetime.now().timestamp()}{ext}'
    else:
        raise ValidationError('Image is not .png or .jpg')
