These are chat archives for django/django

23rd
Jul 2015
milad.kh
@iMilad
Jul 23 2015 08:52
Does someone know how to connect Google Map API v3 to Django database !?
Mir Nazim
@mnazim
Jul 23 2015 09:08
@iMilad provide some details please?
milad.kh
@iMilad
Jul 23 2015 09:14
@mnazim in Html file I created a map with drawing tools to make it possible users draw polygone and now I want to save ite into the Django database, I use backend.postgis (postgres db)
Mir Nazim
@mnazim
Jul 23 2015 09:15
POSTing polygon data with ajax should work fine.
milad.kh
@iMilad
Jul 23 2015 09:18
could you show me some hint ?
Mir Nazim
@mnazim
Jul 23 2015 09:27
  1. collect polygon data with JS.
  2. use jQuery to post this data to a django view
  3. write a django view that will save this data to db.
    (I don’t know a lot about google maps api itself.)
milad.kh
@iMilad
Jul 23 2015 09:32
@mnazim thank you for your help
Alexey Kalinin
@Alkalit
Jul 23 2015 11:11

Hello. I have a problem with test running. I'm trying to go from django 1.5 to django 1.8. After some dancing with migrations I got the runserver command working. But when I try to run tests it throws the exception

(nov_15)alkalit@alkalit-dev:~/.virtualenvs/nov_15/1000novostroek.ru/novostroek$ ./manage.py test novostroek_app
Creating test database for alias 'default'...
Got an error creating the test database: database "test_novostroygid" already exists

Type 'yes' if you would like to try deleting the test database 'test_novostroygid', or 'no' to cancel: yes
Destroying old test database 'default'...
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 30, in run_from_argv
    super(Command, self).run_from_argv(argv)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/core/management/base.py", line 393, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 74, in execute
    super(Command, self).execute(*args, **options)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/core/management/base.py", line 444, in execute
    output = self.handle(*args, **options)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 90, in handle
    failures = test_runner.run_tests(test_labels)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/test/runner.py", line 210, in run_tests
    old_config = self.setup_databases()
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/test/runner.py", line 166, in setup_databases
    **kwargs
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/test/runner.py", line 370, in setup_databases
    serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 368, in create_test_db
    test_flush=not keepdb,
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
    return command.execute(*args, **defaults)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/core/management/base.py", line 444, in execute
    output = self.handle(*args, **options)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 179, in handle
    created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 317, in sync_apps
    cursor.execute(statement)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/db/utils.py", line 97, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/alkalit/.virtualenvs/nov_15/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "django_content_type" does not exist

I suspect that this is due to the order of application migrations, as with the same error I've encountered when applied migrations to the main database. Then I decided to order the application migrations. Any ideas?

Oleg Serbokryl
@Krokop
Jul 23 2015 11:38
Fantomas42/django-blog-zinnia#408
@Alkalit Fantomas42/django-blog-zinnia#408
Portia Burton
@pkafei
Jul 23 2015 15:24
Hello, I'm iterating over images and urls which can be found in my model. What would be the best way for me to put a tag <span>Read Me</span> below each image. Should I include the span tag in the iteration over images and urls, or should the span tag have its own 'for loop'? https://gist.github.com/pkafei/126ec5a9803220c34d1f
Faul
@Faulik
Jul 23 2015 15:43
it's own for loop?
Portia Burton
@pkafei
Jul 23 2015 15:47
yes