Wednesday, February 2, 2022

Django docs failing

The following error occurs when searching the docs for a term. It looks
like the content delivery network node in Sydney Australia has had a
certificate renewal glitch.


Error 503 certificate has expired

certificate has expired


Guru Mediation:

Details: cache-syd10147-SYD 1643862123 79021947

------------------------------------------------------------------------

Varnish cache server


--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8a77e035-5132-a2a6-f34a-a69724c1a4b7%40dewhirst.com.au.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0640f863-9d86-b79b-94b6-25542b2310ab%40dewhirst.com.au.

Django docs failing with search docs - certificate has expired

Error 503 certificate has expired

certificate has expired


Guru Mediation:

Details: cache-syd10147-SYD 1643862123 79021947

------------------------------------------------------------------------

Varnish cache server


--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8a77e035-5132-a2a6-f34a-a69724c1a4b7%40dewhirst.com.au.

Re: Potential bug: mysql-connector-python Django 3.2.11 and third-party packages that populate the Admin Site

Use only the mysqlclient package to populate your admin site with MySQL database.

You can watch this tutorial also : https://youtu.be/SNyCV8vOr-g

On Thu, Feb 3, 2022, 06:19 Richard Mayebo <rmayebo@gmail.com> wrote:
Platform: Observed on Ubuntu 20.04

  1. Install MySQL (Observed on 5.7 and 8.0)
  2. Create a Virtual environment using venv, and activate it.
  3. Install Django 3.2.11
  4. Install mysql-connector-python (Observed on 8.0.26 and 8.0.28)
  5. Install django-easy-audit and/or django-axes (both these third party packages populate the Django Admin Site, where the apparent bug manifests).
  6. Create a superuser (python manage.py createsuperuser)
  7. Start Django (python manage.py runserver)
  8. Launch the Django Admin Site and log in with the superuser.
  9. The pane on the left hand side will have links to objects created by django-easy-audit and/or django-axes, depending on what was installed.
  10. Click on the "Request event" link under "Easy Audit Application" or "Access logs" under "Axes"
  11. RESULT: 
Template error: In template /home/......../.venv/lib/python3.8/site-packages/django/contrib/admin/templates/admin/base.html, error at line 44

   'NoneType' object has no attribute 'day' [OR  'NoneType' object has no attribute 'month'] 

This behaviour is observed on MySQL 5.7.37 and 8.0.26 using my-sql-connector 8.0.26 and 8.0.28.

Replacing MySQL with SQLite or PostgreSQL 12 solves the issue. 

Replacing the connector with mysqlclient-2.1.0 solves the issue. 

This implies there is a bug in the interaction between third-party packages like django-easy-audit and django-axes, Django 3.2.11 and my-sql-connector 8.0.26 and 8.0.28.

Has similar behaviour been observed by anyone else? In any case, how can this be brought to the attention of the development team?

My apologies if this is the wrong forum for this post. I am new at this.

Regards,
Richard.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0a483673-3393-42f9-87a1-c4463c583d7dn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF7qQgCXChSXEoZsFHLK1gcCVh7pPdhiAqrOdmxOXdVdtYPinw%40mail.gmail.com.

migrate exception if multiple databases migrated in a specific order

I just added a second database to our project and was questioning my sanity when I kept getting the exception below in the remote github action tests only (not locally).  I eventually noticed that I was doing the migrations in the reverse order locally.  Once I noticed that, I was able to both reproduce the error locally and avoid the error in the github action.

There are the commands whose order matters:

Works:

python manage.py migrate
python manage.py migrate --database=validation

Results int eh exception:

python manage.py migrate --database=validation
python manage.py migrate

I do not understand why the order matters, but my guess is that there is some code that runs in the migrate command that ignores the --database setting when creating relations.  Is this true?  Or is there a reasonable reason why it MUST be done in the order `default` then `non-default`?

Here is what I have in settings.py:

```
DATABASES = {
   "default": {
       "ENGINE": "django.db.backends.postgresql",
       "NAME": env("DATABASE_NAME"),
       "USER": env("DATABASE_USER"),
       "PASSWORD": env("DATABASE_PASSWORD"),
       "HOST": env("DATABASE_HOST"),
       "PORT": env("DATABASE_PORT"),
   }
}

VALIDATION_ENABLED = False
# If the validation database is configured in the .env file...
if env("VALIDATION_DATABASE_NAME"):
   try:
       DATABASES["validation"] = {
           "ENGINE": "django.db.backends.postgresql",
           "NAME": env("VALIDATION_DATABASE_NAME"),
           "USER": env("VALIDATION_DATABASE_USER"),
           "PASSWORD": env("VALIDATION_DATABASE_PASSWORD"),
           "HOST": env("VALIDATION_DATABASE_HOST"),
           "PORT": env("VALIDATION_DATABASE_PORT"),
       }
       VALIDATION_ENABLED = True
   except Exception as e:
       print(
           f"Could not configure access to the {env('VALIDATION_DATABASE_NAME')} database: {e}"
       )

```

The exception I get is below.  So have I found a bug or is there something for me to learn here?

Thanks,
Rob


The exception:

Running migrations:
 Applying DataRepo.0001_initial... OK
 Applying DataRepo.0002_RemoveDefaultProtocolCategory... OK
 Applying DataRepo.0003_remove_animal_state... OK
 Applying DataRepo.0004_StandardizeMsrun... OK
 Applying DataRepo.0005_auto_20210721_1444... OK
 Applying DataRepo.0006_auto_20210909_1607... OK
 Applying DataRepo.0007_tissue_description... OK
 Applying DataRepo.0008_null_original_peakdata... OK
 Applying DataRepo.0009_compound_synonym... OK
Traceback (most recent call last):
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
   return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "DataRepo_compound" does not exist
LINE 1: ...nd"."formula", "DataRepo_compound"."hmdb_id" FROM "DataRepo_...
                                                            ^
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
 File "manage.py", line 22, in <module>
   main()
 File "manage.py", line 18, in main
   execute_from_command_line(sys.argv)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
   utility.execute()
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute
   self.fetch_command(subcommand).run_from_argv(self.argv)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
   self.execute(*args, **cmd_options)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
   output = self.handle(*args, **options)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/core/management/base.py", line 89, in wrapped
   res = handle_func(*args, **kwargs)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 244, in handle
   post_migrate_state = executor.migrate(
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/migrations/executor.py", line 117, in migrate
   state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
   state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
   state = migration.apply(state, schema_editor)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/migrations/migration.py", line 126, in apply
   operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/migrations/operations/special.py", line 190, in database_forwards
   self.code(from_state.apps, schema_editor)
 File "/home/runner/work/tracebase/tracebase/DataRepo/migrations/0010_default_compound_synonyms.py", line 9, in create_default_synonyms
   for compound in Compound.objects.all():
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/models/query.py", line 280, in __iter__
   self._fetch_all()
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/models/query.py", line 1324, in _fetch_all
   self._result_cache = list(self._iterable_class(self))
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/models/query.py", line 51, in __iter__
   results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
   cursor.execute(sql, params)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/backends/utils.py", line 98, in execute
   return super().execute(sql, params)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
   return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
   return executor(sql, params, many, context)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
   return self.cursor.execute(sql, params)
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
   raise dj_exc_value.with_traceback(traceback) from exc_value
 File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
   return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "DataRepo_compound" does not exist
LINE 1: ...nd"."formula", "DataRepo_compound"."hmdb_id" FROM "DataRepo_...
                                                            ^
 Applying DataRepo.0010_default_compound_synonyms...
Error: 
Process completed with exit code 1.
Make the cache table in the validation database

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20378d09-3566-44a5-8334-589b62eda0c9n%40googlegroups.com.

Potential bug: mysql-connector-python Django 3.2.11 and third-party packages that populate the Admin Site

Platform: Observed on Ubuntu 20.04

  1. Install MySQL (Observed on 5.7 and 8.0)
  2. Create a Virtual environment using venv, and activate it.
  3. Install Django 3.2.11
  4. Install mysql-connector-python (Observed on 8.0.26 and 8.0.28)
  5. Install django-easy-audit and/or django-axes (both these third party packages populate the Django Admin Site, where the apparent bug manifests).
  6. Create a superuser (python manage.py createsuperuser)
  7. Start Django (python manage.py runserver)
  8. Launch the Django Admin Site and log in with the superuser.
  9. The pane on the left hand side will have links to objects created by django-easy-audit and/or django-axes, depending on what was installed.
  10. Click on the "Request event" link under "Easy Audit Application" or "Access logs" under "Axes"
  11. RESULT: 
Template error: In template /home/......../.venv/lib/python3.8/site-packages/django/contrib/admin/templates/admin/base.html, error at line 44

   'NoneType' object has no attribute 'day' [OR  'NoneType' object has no attribute 'month'] 

This behaviour is observed on MySQL 5.7.37 and 8.0.26 using my-sql-connector 8.0.26 and 8.0.28.

Replacing MySQL with SQLite or PostgreSQL 12 solves the issue. 

Replacing the connector with mysqlclient-2.1.0 solves the issue. 

This implies there is a bug in the interaction between third-party packages like django-easy-audit and django-axes, Django 3.2.11 and my-sql-connector 8.0.26 and 8.0.28.

Has similar behaviour been observed by anyone else? In any case, how can this be brought to the attention of the development team?

My apologies if this is the wrong forum for this post. I am new at this.

Regards,
Richard.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0a483673-3393-42f9-87a1-c4463c583d7dn%40googlegroups.com.

help creating a nested serializer using drf

good day guys, i'm working on a project and i'm creating mulitiple model linked using foriegnKey field but i'm getting a relatedManager object has no attribute id
err
below is the link to my question on slack, hope anyone can help out

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHLKn70wCHgjELwS19KcfQDGzz5jMJWvWcHiWGcvhC%3DL540fFg%40mail.gmail.com.

Re:

-----BEGIN PGP PUBLIC KEY BLOCK-----

xsDNBGBJfrABDACxIFOMQIsP94wTkgf76JEHyTITmYnprsTeRmDet01G5etZ9ZHm
RmrqYVFzXu1aSBbaejm/ppbRrBB7YmFETbpnZepWJnuhridvjV37duRH3g/9ppiy
tNkhOOIYA/l8ppvyaRlrp/jPjAm27HVxi1Nu0syaWwTFKbUTtLKldIhuWvAXkgxp
xyBdB3jfmKoJ4rvTzZU+saKgaFExRmdd5TptwRP9cPRWIoR5fcRA8RQ1X66NkIpl
VBbH7NeLuTtICAa0dnyTh50x+Wapu1kDEWmr8ssUzf6c8yBJAHKBohQowZmQ8sYt
w2h4gX0zT4V3TY9y8TvTFGhPlM7l5QRFBlZqCBp5K/6xkyaAf+VlUwsdMqe8UOz5
mMJ5ZLU9JEzFyfSiM8xScwIzPcyQhOiLAgqIozTag+9B6QgD66Xa80yrFmfXyVtU
OtS6ykQsepR/fq6ySUKjWGFJ/Psq0wNuBaCHzEwEfeShZquL/jXmcUFJhVbeDYIZ
cPngktFCZ30fYuMAEQEAAc0mS2FzcGVyIExhdWRydXAgPGxhdWRydXBAc3RhY2t0
cmFjZS5kaz7CwQ8EEwEIADkWIQS5plkBvlt0D6iFDi7l2crGSqpV6wUCYEl+sQUJ
BaOagAIbAwULCQgHAgYVCAkKCwIFFgIDAQAACgkQ5dnKxkqqVeuAxQwApU4laVk3
4B2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LmmWQG+W3QPqIUOLuXZysZKqlXrBQJgSX6x
BQkFo5qAAhsMAAoJEOXZysZKqlXrbHsL/0rWbmkdYmZ+Wdj9vrhxoxM8WDp3bCdr
5E1bziJYkG+VuEejk60rlURO6dZ9uJMtDnKMTZdJ26cN01iwWG/O83pOL9vyMOj5
q+XC4nmi4DV/N2wneBH4VyNfv1fNubDrE0M8iXX/WECIG2RSE0N6C4RfKIC03ysl
L4lnhSc426Bnxkf8sZm+oFo4ian0GcuNdIQBdBdAek9F2CX6whDbL4mZFAeY/e6e
mWmP8Y/z4X2qaCpW/GHS+XFccT1h8CxqsFxnAhnecjdMCv/TJLXMNk9LihEeUEZo
4U7bitCfyO17dt6NC/7wbGZCJmNPO7V3YYeI8MwzOkvmXqLcHz0IPQATuLMB1HKr
oG/Vrwq029ftqnuDluS/DzmuIqWLuAT+2nIe1JLWFlS9OUTi4i+y0NDlxWCZOaGp
ucR+ueFKv1de3nVjdd6oN+MIO9gQ3NE53FrO46A3APy6Ex02Mxub8nNnQjXcStHZ
BHO6KilQ+QLzSektD8IpHM7tR6P+5PP6AQ==
=NePe
-----END PGP PUBLIC KEY BLOCK-----
On 02/02/2022 17.11, Gautam Ankul wrote:
> How to use fee due notifications in django something helpe
>

The same way you use any notifications in django anything hehe

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3c42eefe-3932-0ac2-5e17-aa4bac5ba4bd%40stacktrace.dk.