FIXED [Was: Django docs failing]

2022-02-02 Thread Mike Dewhirst

The internet seems to be self healing!

On 3/02/2022 3:47 pm, Mike Dewhirst wrote:
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/80c99857-f22e-d2fe-f623-a41b7687d796%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Barcode

2022-02-02 Thread Derek
We implemented bar coding on the back end - e.g., to generate a PDF which 
the client then prints.

One library you can use for this is:
https://pypi.org/project/treepoem/


On Wednesday, 2 February 2022 at 02:05:56 UTC+2 
andres@uaiinpebi-cric.edu.co wrote:

> Does anyone have experience with UCC/EAN-128 barcodes? I am using a 
> javascript barcode js library with django to implement the barcode but it 
> is generating errors when reading if anyone knows any library or api that 
> can be used that complies with the UCC/EAN-128 parameters that can provide 
> me with information
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6ea4902e-9a13-4aad-9c8a-84a217d2a991n%40googlegroups.com.


Django docs failing

2022-02-02 Thread Mike Dewhirst
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+unsubscr...@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+unsubscr...@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.


OpenPGP_signature
Description: OpenPGP digital signature


Django docs failing with search docs - certificate has expired

2022-02-02 Thread Mike Dewhirst


 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+unsubscr...@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.


OpenPGP_signature
Description: OpenPGP digital signature


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

2022-02-02 Thread Lakshyaraj Dash X-D 25
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  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+unsubscr...@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF7qQgCXChSXEoZsFHLK1gcCVh7pPdhiAqrOdmxOXdVdtYPinw%40mail.gmail.com.


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

2022-02-02 Thread Richard Mayebo
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+unsubscr...@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.


migrate exception if multiple databases migrated in a specific order

2022-02-02 Thread Robert Leach
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 
   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
   

help creating a nested serializer using drf

2022-02-02 Thread ola neat
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
https://stackoverflow.com/questions/70928548/how-to-fix-attributeerror-relatedmanager-object-has-no-attribute-id

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHLKn70wCHgjELwS19KcfQDGzz5jMJWvWcHiWGcvhC%3DL540fFg%40mail.gmail.com.


Re:

2022-02-02 Thread sebasti...@gmail.com
You insert following in your base template:


 {% if messages %}



{% for message in messages %}
{{ message|safe }}

{% endfor %}
{% endif %}
{% if form.errors %}


{% for key, value in form.errors.items %}

{{ key }}:{{ value }}

{% endfor %}








{% endif %}


gautam...@gmail.com schrieb am Mittwoch, 2. Februar 2022 um 17:12:16 UTC+1:

> How to use fee due notifications in django something helpe
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a61fb3f8-ce19-4a6d-b522-a84eac16862dn%40googlegroups.com.


Multiple Choices as Label

2022-02-02 Thread sebasti...@gmail.com
Hello,

I want in Listview on left side a filterform, where i can filter after 
sizes and/or colors. This are Multiple Choices Fields. I have attached a 
image where this fields are shown. For example XS has Key 1 and XL Key 2 
and Color Black have Key 1 then i want when user clicks on size XS,XL and 
Color Black that Post submit size=[1,2] and color=[1]

How is this possible?

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4210761f-f5e1-4d72-b683-d3f5d5108f48n%40googlegroups.com.


Re:

2022-02-02 Thread Prasad Ajmire
Gautam

https://www.digitalocean.com/community/tutorials/how-to-send-web-push-notifications-from-django-applications

refer above link probably this will help you

On Wed, Feb 2, 2022 at 9:42 PM Gautam Ankul  wrote:

> How to use fee due notifications in django something helpe
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALKR2n1UW%3DFFdq1NAbEJADyhCxOtg-_g68mtpu-mqPaC7tGLfw%40mail.gmail.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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJC%2BgnD6z96KF0ntq-PUn7izJ88kQ7OUrTPub3a0qR5fy0J89w%40mail.gmail.com.


Re:

2022-02-02 Thread Kasper Laudrup

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+unsubscr...@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.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


[no subject]

2022-02-02 Thread Gautam Ankul
How to use fee due notifications in django something helpe

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALKR2n1UW%3DFFdq1NAbEJADyhCxOtg-_g68mtpu-mqPaC7tGLfw%40mail.gmail.com.


RES: Help

2022-02-02 Thread Fernando Jover
So thank you Sebastian! ;o) Enviado do Email para Windows De: Sebastian JungEnviado:quarta-feira, 2 de fevereiro de 2022 12:30Para: django-users@googlegroups.comAssunto: Re: Help You have a package https://pypi.org/project/django-emoji/ installed and now you must in yozr settings.py set this variable Fernando Jover  schrieb am Mi., 2. Feb. 2022, 16:26:Hi guys! i am learn Pythonand Pycharm show me this: raise ImproperlyConfigured(django.core.exceptions.ImproperlyConfigured: Requested setting EMOJI_IMG_TAG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. How can i chabge this in my settings? Enviado do Email para Windows -- 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+unsubscr...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0397E3AC-5EB1-4684-958B-3CC47136F043%40hxcore.ol.-- 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+unsubscr...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKGT9mzdUgB2u2Wd5YiJGGQOd-eTG%2BOvEo3y4q3fYtjGWopNbg%40mail.gmail.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+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/74370E49-C1BD-4BDC-A51C-3A9BBCB397DE%40hxcore.ol.


Encryption in Django Field

2022-02-02 Thread Vivek Kumar Singh
Is there a way we can encrypt the value in the field value and decrypt it 
when user pass the correct password

my model -> 
data -> charfield
password -> charfield

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20e405b5-a05a-47ae-807f-bd10be667191n%40googlegroups.com.


Re: Help

2022-02-02 Thread Sebastian Jung
You have a package https://pypi.org/project/django-emoji/ installed and now
you must in yozr settings.py set this variable

Fernando Jover  schrieb am Mi., 2. Feb. 2022,
16:26:

> Hi guys!
>
>
>
> i am learn Pythonand Pycharm show me this:
>
>
>
> raise ImproperlyConfigured(
>
> django.core.exceptions.ImproperlyConfigured: Requested setting
> EMOJI_IMG_TAG, but settings are not configured. You must either define the
> environment variable DJANGO_SETTINGS_MODULE or call settings.configure()
> before accessing settings.
>
>
>
> How can i chabge this in my settings?
>
>
>
> Enviado do Email 
> para Windows
>
>
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0397E3AC-5EB1-4684-958B-3CC47136F043%40hxcore.ol
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKGT9mzdUgB2u2Wd5YiJGGQOd-eTG%2BOvEo3y4q3fYtjGWopNbg%40mail.gmail.com.


Help

2022-02-02 Thread Fernando Jover
Hi guys!  i am learn Pythonand Pycharm show me this: raise ImproperlyConfigured(django.core.exceptions.ImproperlyConfigured: Requested setting EMOJI_IMG_TAG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. How can i chabge this in my settings? Enviado do Email para Windows 



-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0397E3AC-5EB1-4684-958B-3CC47136F043%40hxcore.ol.


Re: web page blank

2022-02-02 Thread kka kar
I recreated the project and changed the view function to the below, and it 
now works fine for me:

def home(request):
context = {
'posts': post
}
return render(request, 'home.html', context)

On Wednesday, February 2, 2022 at 8:23:46 AM UTC devfem...@gmail.com wrote:

> Is it working fine for you?
>
>
> If not url blog/home.html?
>
> On Wed, Feb 2, 2022, 08:08 Sebastian Jung  wrote:
>
>> Hello,
>>
>> Please try:
>>
>> context = {
>> 'posts': post
>> }
>>
>> 'Delvin Alexander' via Django users  schrieb 
>> am Mi., 2. Feb. 2022, 06:59:
>>
>>> Hello everyone,
>>>
>>> I am currently following a django tutorial regarding applications. I 
>>> have followed through completely but for some reason, when I run server, i 
>>> incur no errors but the web page is blank. Why would this be?
>>>
>>> Here is what is not displayed:
>>>
>>> from my Home.html file:
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> {% for post in posts %}
>>> {{ post.title }}
>>> By {{ post.author }} on {{ post.date_posted}}
>>> {{ post.content }}
>>> {% endfor %}
>>>
>>> 
>>> 
>>>
>>> from my views.py file:
>>> from django.shortcuts import render
>>>
>>> post = [
>>> {
>>> 'author': 'CoreyMS',
>>> 'title': 'Blog Post',
>>> 'content': 'First Post Content',
>>> 'date_posted': 'August 27, 2018'
>>> },
>>> {
>>> 'author': 'Jane Doe',
>>> 'title': 'Blog Post 2',
>>> 'content': 'Second Post Content',
>>> 'date_posted': 'August 28, 2018'
>>> }
>>> ]
>>>
>>> def home(request):
>>> context = {
>>> 'post': post
>>> }
>>> return render(request, 'blog/home.html', context)
>>>
>>> def about(request):
>>> return render(request, 'blog/about.html')
>>>
>>> My urls.py:
>>> from django.urls import path
>>> from . import views
>>>
>>> urlpatterns = [
>>> path('', views.home, name='blog-home'),
>>> path('about/', views.about, name='blog-about'),
>>> ]
>>>   
>>>
>>> -- 
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/e9b557a6-403b-46ce-bc18-8d19b0091f2an%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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAKGT9mzFaC4Eq9B_76nb0N2%2BRW-%2BNkbLMdfJT0Vph2qWuGefOw%40mail.gmail.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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c2f8ef77-d0ef-4868-8680-0314442952f9n%40googlegroups.com.


Django cache template

2022-02-02 Thread Dev femibadmus
How do I not allow Django to cache template, data doesn't change until
several refresh have used @never_cache and cache_control doing everything
well but still not working

On Tue, Feb 1, 2022, 08:59 Mariusz Felisiak 
wrote:

> Details are available on the Django project weblog:
>
> https://www.djangoproject.com/weblog/2022/feb/01/security-releases/
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4f6f73a3-1066-8081-3950-fe0aa7634d11%40gmail.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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAD9bWYx8QVCapZYE4VZRhawMiRS6mF4i8ejg_B2ChqoCLqR1rQ%40mail.gmail.com.


Re: web page blank

2022-02-02 Thread Dev femibadmus
Is it working fine for you?


If not url blog/home.html?

On Wed, Feb 2, 2022, 08:08 Sebastian Jung  wrote:

> Hello,
>
> Please try:
>
> context = {
> 'posts': post
> }
>
> 'Delvin Alexander' via Django users 
> schrieb am Mi., 2. Feb. 2022, 06:59:
>
>> Hello everyone,
>>
>> I am currently following a django tutorial regarding applications. I have
>> followed through completely but for some reason, when I run server, i incur
>> no errors but the web page is blank. Why would this be?
>>
>> Here is what is not displayed:
>>
>> from my Home.html file:
>> 
>> 
>> 
>> 
>> 
>> 
>> {% for post in posts %}
>> {{ post.title }}
>> By {{ post.author }} on {{ post.date_posted}}
>> {{ post.content }}
>> {% endfor %}
>>
>> 
>> 
>>
>> from my views.py file:
>> from django.shortcuts import render
>>
>> post = [
>> {
>> 'author': 'CoreyMS',
>> 'title': 'Blog Post',
>> 'content': 'First Post Content',
>> 'date_posted': 'August 27, 2018'
>> },
>> {
>> 'author': 'Jane Doe',
>> 'title': 'Blog Post 2',
>> 'content': 'Second Post Content',
>> 'date_posted': 'August 28, 2018'
>> }
>> ]
>>
>> def home(request):
>> context = {
>> 'post': post
>> }
>> return render(request, 'blog/home.html', context)
>>
>> def about(request):
>> return render(request, 'blog/about.html')
>>
>> My urls.py:
>> from django.urls import path
>> from . import views
>>
>> urlpatterns = [
>> path('', views.home, name='blog-home'),
>> path('about/', views.about, name='blog-about'),
>> ]
>>
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/e9b557a6-403b-46ce-bc18-8d19b0091f2an%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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKGT9mzFaC4Eq9B_76nb0N2%2BRW-%2BNkbLMdfJT0Vph2qWuGefOw%40mail.gmail.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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAD9bWYzcLeS5HbKQvpa3v%3Drt015_Pufd8BVMe7R_U0OaGZO09g%40mail.gmail.com.


Re: Resource leaks from FieldFile's implicit open?

2022-02-02 Thread Antonis Christofides
I think that the documentation is not entirely clear. I wouldn't say that the 
object "wrapped by" FieldFile is "a wrapper around the result of" 
Storage.open(). It is actually FieldFile.open() that is a wrapper around 
Storage.open(). Therefore I think I'd rephrase as follows:


   FieldFile is a subclass of File. While File is a wrapper around Python's
   built-in file object, FieldFile uses the underlying Storage.

As far as I can see by reading the code, you can write code like this:

   with some_file_field:
    ...

Inside the "with" block you will probably access `some_file_field.file`. 
Apparently accessing that attribute is what opens the file (but accessing the 
`size` attribute also seems to be opening it, which is probably suboptimal.)


I'm not certain about files that don't exist. You might want to wrap the "with" 
block in a try-except, but I'm not certain about which exceptions you want to 
catch. It's probably ValueError and IOError.


Regards,

Antonis

Antonis Christofides
+30-6979924665 (mobile)


On 01/02/2022 21.22, Carsten Fuchs wrote:

Dear group,

despite a lot of reading and searching I still don't understand how FieldFiles 
work.

The documentation 
athttps://docs.djangoproject.com/en/4.0/ref/models/fields/#django.db.models.fields.files.FieldFile
  says:


The API of FieldFile mirrors that of File, with one key difference: The object 
wrapped by the class is not necessarily a wrapper around Python’s built-in file 
object. Instead, it is a wrapper around *** the result of the Storage.open() 
method ***, which may be a File object, or it may be a custom storage’s 
implementation of the File API.

(I added markers to indicate the portion that I have trouble with.)

As far as I understand this, whenever a `FieldFile` is instantiated, 
`Storage.open()` is called. Thus, if the underlying storage is the 
`FileSystemStorage`, a Python file object is opened.

However, how is this file handle closed again?

It looks as if it stays open until garbage collected, that is, possibly for a 
very long time.

Another consequence besides the potential resource leak seems to be that the 
implicit open will raise an exception if the file that the `FieldFile` refers 
to doesn't exist. As I don't exactly understand when this opening occurs, a lot 
of code must be wrapped in try-except blocks to handle this?

Best regards,
Carsten



--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ea9e066d-49b4-2c75-c477-10f9306d6221%40antonischristofides.com.