• Как правильно перенести django проект на другой комп?

    ruchej
    @ruchej Автор вопроса
    Дмитрий Бурнаев:

    (mk31) aleks@debian:~/WORK/djpr/mk31$ python3 manage.py migrate
    Traceback (most recent call last):
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/utils.py", line 63, in execute
    return self.cursor.execute(sql)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 101, in execute
    return self.cursor.execute(query, args)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/cursors.py", line 166, in execute
    result = self._query(query)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 856, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1057, in _read_query_result
    result.read()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1340, in read
    first_packet = self.connection._read_packet()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1014, in _read_packet
    packet.check_error()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 393, in check_error
    err.raise_mysql_exception(self._data)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
    pymysql.err.ProgrammingError: (1146, "Table 'dbmk31.django_migrations' doesn't exist")

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 57, in ensure_schema
    editor.create_model(self.Migration)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 302, in create_model
    self.execute(sql, params or None)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 119, in execute
    cursor.execute(sql, params)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/utils.py", line 80, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/utils.py", line 63, in execute
    return self.cursor.execute(sql)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 101, in execute
    return self.cursor.execute(query, args)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/cursors.py", line 166, in execute
    result = self._query(query)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 856, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1057, in _read_query_result
    result.read()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1340, in read
    first_packet = self.connection._read_packet()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1014, in _read_packet
    packet.check_error()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 393, in check_error
    err.raise_mysql_exception(self._data)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
    django.db.utils.ProgrammingError: (1146, "Table 'dbmk31.django_migrations' doesn't exist")

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "manage.py", line 40, in
    execute_from_command_line(sys.argv)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 83, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/executor.py", line 20, in __init__
    self.loader = MigrationLoader(self.connection)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/loader.py", line 52, in __init__
    self.build_graph()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/loader.py", line 209, in build_graph
    self.applied_migrations = recorder.applied_migrations()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
    self.ensure_schema()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 59, in ensure_schema
    raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
    django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table ((1146, "Table 'dbmk31.django_migrations' doesn't exist"))
    (mk31) aleks@debian:~/WORK/djpr/mk31$ python3 manage.py makemigrations
    Traceback (most recent call last):
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/utils.py", line 63, in execute
    return self.cursor.execute(sql)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 101, in execute
    return self.cursor.execute(query, args)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/cursors.py", line 166, in execute
    result = self._query(query)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 856, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1057, in _read_query_result
    result.read()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1340, in read
    first_packet = self.connection._read_packet()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1014, in _read_packet
    packet.check_error()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 393, in check_error
    err.raise_mysql_exception(self._data)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
    pymysql.err.ProgrammingError: (1146, "Table 'dbmk31.django_migrations' doesn't exist")

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 57, in ensure_schema
    editor.create_model(self.Migration)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 302, in create_model
    self.execute(sql, params or None)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 119, in execute
    cursor.execute(sql, params)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/utils.py", line 80, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/utils.py", line 63, in execute
    return self.cursor.execute(sql)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 101, in execute
    return self.cursor.execute(query, args)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/cursors.py", line 166, in execute
    result = self._query(query)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 856, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1057, in _read_query_result
    result.read()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1340, in read
    first_packet = self.connection._read_packet()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1014, in _read_packet
    packet.check_error()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 393, in check_error
    err.raise_mysql_exception(self._data)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
    django.db.utils.ProgrammingError: (1146, "Table 'dbmk31.django_migrations' doesn't exist")

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "manage.py", line 40, in
    execute_from_command_line(sys.argv)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/commands/makemigrations.py", line 110, in handle
    loader.check_consistent_history(connection)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/loader.py", line 282, in check_consistent_history
    applied = recorder.applied_migrations()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
    self.ensure_schema()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 59, in ensure_schema
    raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
    django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table ((1146, "Table 'dbmk31.django_migrations' doesn't exist"))
    (mk31) aleks@debian:~/WORK/djpr/mk31$ python manage.py makemigrations
    Traceback (most recent call last):
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/utils.py", line 63, in execute
    return self.cursor.execute(sql)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 101, in execute
    return self.cursor.execute(query, args)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/cursors.py", line 166, in execute
    result = self._query(query)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 856, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1057, in _read_query_result
    result.read()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1340, in read
    first_packet = self.connection._read_packet()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1014, in _read_packet
    packet.check_error()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 393, in check_error
    err.raise_mysql_exception(self._data)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
    pymysql.err.ProgrammingError: (1146, "Table 'dbmk31.django_migrations' doesn't exist")

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 57, in ensure_schema
    editor.create_model(self.Migration)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 302, in create_model
    self.execute(sql, params or None)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 119, in execute
    cursor.execute(sql, params)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/utils.py", line 80, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/utils.py", line 63, in execute
    return self.cursor.execute(sql)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 101, in execute
    return self.cursor.execute(query, args)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/cursors.py", line 166, in execute
    result = self._query(query)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 856, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1057, in _read_query_result
    result.read()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1340, in read
    first_packet = self.connection._read_packet()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 1014, in _read_packet
    packet.check_error()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/connections.py", line 393, in check_error
    err.raise_mysql_exception(self._data)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
    django.db.utils.ProgrammingError: (1146, "Table 'dbmk31.django_migrations' doesn't exist")

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "manage.py", line 40, in
    execute_from_command_line(sys.argv)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/core/management/commands/makemigrations.py", line 110, in handle
    loader.check_consistent_history(connection)
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/loader.py", line 282, in check_consistent_history
    applied = recorder.applied_migrations()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
    self.ensure_schema()
    File "/home/aleks/WORK/env/mk31/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 59, in ensure_schema
    raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
    django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table ((1146, "Table 'dbmk31.django_migrations' doesn't exist"))

  • Как правильно перенести django проект на другой комп?

    ruchej
    @ruchej Автор вопроса
    Сделал бэкап БД, тогда все заработало.
    Но всё равно остаётся вопрос: почему при создании пустой БД не делается миграция?
  • Как разбить на категории в админке в одном приложении?

    ruchej
    @ruchej Автор вопроса
    Может я чего не понял, но приложение одно
  • Как разбить на категории в админке в одном приложении?

    ruchej
    @ruchej Автор вопроса
    Это вариант применения стороннего приложения. Хотелось бы обойтись штатными средствами
  • Как правильно сохранить результат изменения значения в БД?

    ruchej
    @ruchej Автор вопроса
    Roman Kitaev: что бы изменить размер картинки при загрузки, надо использовать чужое приложение?! которое к тому же имеет размер больший, чем кусок моего кода. Не хочу использовать чужой код и не понимать, что он там творит, тем более на этапе изучения джанго.
    Так можно нагородить свой проект кучей чужих модулей из-за одной функций.
  • Почему работает не так, как я хочу?

    ruchej
    @ruchej Автор вопроса
    Да, тут уже вроде результат нужный! Уже завтра буду отрабатывать это подробней.
    Можете дать ссылку, где про fetch разжёвано? А то не понимаю, зачем писать эти then. Почему нельзя писать что-то типа:
    let dd = fetch('getproduct/'+prod_id)
    data = dd.data
    т.е. получаем объект запроса, а данные из его св-в
  • Почему работает не так, как я хочу?

    ruchej
    @ruchej Автор вопроса
    Как же правильно сделать? дождаться ответ
  • Как в django определить, что запрос ajax XMLHttpRequest?

    ruchej
    @ruchej Автор вопроса
    sim3x: и со слешем на конце и без него результат тот же
  • Как определить, что нажата ссылка с определённым свойством?

    ruchej
    @ruchej Автор вопроса
    Stalker_RED: Получается, что всё равно надо писать функцию внутри функции, т.е. просто так написать нельзя: link.addEventListener('click', slideshow(evt) ; }
    let linkNodes = document.querySelectorAll('a[rel=slide]') // находим все ссылки с rel=slide
    let slideLinks = [].slice.call(linkNodes)
    slideLinks.forEach(link=>{ 
        link.addEventListener('click', function(evt){ // вешаем на каждую обработчик
        slideshow(evt) ;    
      })
    })
    
    function slideshow(evt) {
            let link = evt.currentTarget ;
            console.log('clicked', link.href) ;
            return false;
    }

    Вот только ещё задача, что бы не происходил переход по ссылки. Ставил return false; но все равно переход происходит.
    link.addEventListener('click', function(evt){ // вешаем на каждую обработчик
        slideshow(evt) ; 
        return false;  
      })

    А вообще, благодарю за помощь.
  • Как определить, что нажата ссылка с определённым свойством?

    ruchej
    @ruchej Автор вопроса
    Stalker_RED: а как в вызываемую функцию передать вызвавший объект, тогда? И у вас в коде написано let link = evt.target, что даёт ссылку на объект img. Написал let link = evt.currentTarget, тогда получил объект "a" - ссылку
  • Как определить, что нажата ссылка с определённым свойством?

    ruchej
    @ruchej Автор вопроса
    Как правильно подставить внешнюю функцию, которую вызвать, а вписанную функцию?
    Сделал так, но ошибка:
    slideLinks.forEach(link=>{
    link.addEventListener('click', slideshow(evt))})
  • Миниатюры фотогалереи создавать на сервере или на лету?

    ruchej
    @ruchej Автор вопроса
    Раз все эти приложения создают миниатюру и хранят всё равно на сервере и используют дальше, то в них и смысла нет. Так можно сразу создавать миниатюры при загрузки и использовать.
  • Как через views заменить блок?

    ruchej
    @ruchej Автор вопроса
    Animkim: есть где-нибудь такой пример, как это работает?
  • Как работать с объектом модели в шаблоне?

    ruchej
    @ruchej Автор вопроса
    Степан: что значит images_set.all? Как понимаю images это обращение к модели? где по этим св-вам взять инфу? Просто, если включить отладку питона, то я могу узнать св-ва через dir(), а в шаблоне так не узнать.
  • Как работать с объектом модели в шаблоне?

    ruchej
    @ruchej Автор вопроса
    Степан: Да.
    class FurnitureProduct(models.Model):
        '''Мебельное изделие. Для каждой категории вписывается своё изделие
            со своими характеристиками'''
        catalog = models.ForeignKey(Catalogue, on_delete=models.CASCADE, verbose_name='Каталог', default=1)
        furnproduct = models.CharField(max_length=100, verbose_name='Изделие')
    
    class Images(models.Model):
        '''Таблица путей изображений'''
        furnproduct = models.ForeignKey(FurnitureProduct, on_delete=models.CASCADE, verbose_name='Изделие')
        imagepath = models.ImageField(upload_to=PathAndRename('images'), verbose_name='Изображение')
  • Как работать с объектом модели в шаблоне?

    ruchej
    @ruchej Автор вопроса
    Есть таблица изделий. Из вьюшки в шаблон передал их, как в уроке products = FurnitureProduct.objects.filter(catalog_id=catalog.pk). Есть таблица Images содержащая ссылки на картинки изделий. Надо отобрать картинки для каждого изделия из Images по полю или св-ву furnproduct_id.