Re: ERROR

2020-08-09 Thread Julio Cojom
It is js error, show the script part. It seems like you referenced a
variable before declare it.

On Sun, Aug 9, 2020, 8:50 AM Yemin Sajid  wrote:

> I think the error is from the frontend javascript code. Can u share
> snippets of that code?
>
> On Sun, Aug 9, 2020 at 8:30 AM Kovy Jacob  wrote:
>
>> Are you switching into your projects directory and then using 'python
>> manage.py runserver' from command prompt/terminal to run your website?
>>
>> On Sat, Aug 8, 2020 at 4:25 PM Agoua David  wrote:
>>
>>> Can you send a screenshot of the view file
>>>
>>> Le sam. 8 août 2020 à 20:21, traore arouna  a
>>> écrit :
>>>
 Hello
 I am here because I am developing an e-commerce application.
 But at a certain level of my code when I run my server with the command
 python manage runserver
 I have an error message
 Uncaught ReferenceError: info is not defined

 --
 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/2fdbf0c6-5f2e-4120-a524-6f3171c50389o%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/CAByCr6gT6SJ1EHyDMTGKb6Q73rbRJXWnd7XbgOeq7WE%2BLU3sAg%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/CACMwF3U_6LtFunxAm%2BoSjPFuAYyFGQ7QsgctyigqJXCathe8Lw%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/CAFzgvyEGOxaYRrpXiW0iPOjdy1tm9LNe1ZOVT7jTkXT56mHh0A%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/CAHRQUHkW8h-3eO29NdpSGGW9T1vV2heEgO1F2UNEa7Y%3DLmVbmg%40mail.gmail.com.


Re: Tried to migrate custom user model and got this error shown below

2020-08-09 Thread Yemin Sajid
If your project is not deployed to production yet, the easiest solution is
to delete the whole existing database (sqlite db file or postgres/mysql
database) and try to apply the migrations.

But if the project is already in the production, you would need to be
careful with that. I would suggest
1. Make a backup of your data
2. Delete the tables of admin, auth and django_migration apps.
3. Apply the migrations
4. Insert the old users into your new custom user table.

On Mon, Aug 10, 2020 at 12:01 AM Ayser shuhaib 
wrote:

> Truro delete the files inside the migrations folder then run The
> makemigrations command then migrate
>
> On Sun, 09 Aug 2020 at 19:58, FIRDOUS BHAT  wrote:
>
>> django.db.migrations.exceptions.InconsistentMigrationHistory: Migration
>> admin.0001_initial is applied before its dependency users.0001_initial on
>> database 'default'.
>>
>> --
>> 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/94c323ed-996c-40a1-bb34-18339ee8d47co%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/CAE0AZG%2BV_HSWUMSLARpDPJ1aWB0uea8o0Wvm7gmNVt5016Tfuw%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/CAFzgvyFZxbnSPBu61vaP%3D4TVvFiH4WVF915osfP0h9Fm_-1bDw%40mail.gmail.com.


Re: Tried to migrate custom user model and got this error shown below

2020-08-09 Thread Ayser shuhaib
Truro delete the files inside the migrations folder then run The
makemigrations command then migrate

On Sun, 09 Aug 2020 at 19:58, FIRDOUS BHAT  wrote:

> django.db.migrations.exceptions.InconsistentMigrationHistory: Migration
> admin.0001_initial is applied before its dependency users.0001_initial on
> database 'default'.
>
> --
> 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/94c323ed-996c-40a1-bb34-18339ee8d47co%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/CAE0AZG%2BV_HSWUMSLARpDPJ1aWB0uea8o0Wvm7gmNVt5016Tfuw%40mail.gmail.com.


Tried to migrate custom user model and got this error shown below

2020-08-09 Thread FIRDOUS BHAT
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration 
admin.0001_initial is applied before its dependency users.0001_initial on 
database 'default'.

-- 
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/94c323ed-996c-40a1-bb34-18339ee8d47co%40googlegroups.com.


Re: ERROR

2020-08-09 Thread Yemin Sajid
I think the error is from the frontend javascript code. Can u share
snippets of that code?

On Sun, Aug 9, 2020 at 8:30 AM Kovy Jacob  wrote:

> Are you switching into your projects directory and then using 'python
> manage.py runserver' from command prompt/terminal to run your website?
>
> On Sat, Aug 8, 2020 at 4:25 PM Agoua David  wrote:
>
>> Can you send a screenshot of the view file
>>
>> Le sam. 8 août 2020 à 20:21, traore arouna  a
>> écrit :
>>
>>> Hello
>>> I am here because I am developing an e-commerce application.
>>> But at a certain level of my code when I run my server with the command
>>> python manage runserver
>>> I have an error message
>>> Uncaught ReferenceError: info is not defined
>>>
>>> --
>>> 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/2fdbf0c6-5f2e-4120-a524-6f3171c50389o%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/CAByCr6gT6SJ1EHyDMTGKb6Q73rbRJXWnd7XbgOeq7WE%2BLU3sAg%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/CACMwF3U_6LtFunxAm%2BoSjPFuAYyFGQ7QsgctyigqJXCathe8Lw%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/CAFzgvyEGOxaYRrpXiW0iPOjdy1tm9LNe1ZOVT7jTkXT56mHh0A%40mail.gmail.com.


Re: SESSION_COOKIE_SAMESITE - does None still disable the flag?

2020-08-09 Thread אורי
Hi,

https://github.com/django/django/blob/master/django/conf/global_settings.py#L472-L473


 # Whether to set the flag restricting cookie leaks on cross-site requests.
# This can be 'Lax', 'Strict', or None to disable the flag.

This is not what is written in
https://docs.djangoproject.com/en/3.1/ref/settings/#std:setting-SESSION_COOKIE_SAMESITE
( False:
disables the flag. )


אורי
u...@speedy.net


‪On Sun, Aug 9, 2020 at 3:47 PM ‫אורי‬‎  wrote:‬

> Hi,
>
> *SESSION_COOKIE_SAMESITE* - We use None to disable the flag in Django
> 3.0. Will None (not as a string) disable the flag also in Django 3.1, or do
> we have to convert it to False?
>
>
> https://docs.djangoproject.com/en/3.0/ref/settings/#std:setting-SESSION_COOKIE_SAMESITE
>
>
>
> https://docs.djangoproject.com/en/3.1/ref/settings/#std:setting-SESSION_COOKIE_SAMESITE
>
>
> אורי
> u...@speedy.net
>

-- 
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/CABD5YeENFV_FAawgKz9%3DQZvz95cQYcxCqe4bhiqmO4FFLUJ4JQ%40mail.gmail.com.


SESSION_COOKIE_SAMESITE - does None still disable the flag?

2020-08-09 Thread אורי
Hi,

*SESSION_COOKIE_SAMESITE* - We use None to disable the flag in Django 3.0.
Will None (not as a string) disable the flag also in Django 3.1, or do we
have to convert it to False?

https://docs.djangoproject.com/en/3.0/ref/settings/#std:setting-SESSION_COOKIE_SAMESITE


https://docs.djangoproject.com/en/3.1/ref/settings/#std:setting-SESSION_COOKIE_SAMESITE


אורי
u...@speedy.net

-- 
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/CABD5YeH%3DVh_8ZR%2B5VijoUoDnpLaTXOA%2B4N2BHzuh5RfQ%3DKGYuA%40mail.gmail.com.


Re: Security issue in django.db.models

2020-08-09 Thread Liu Zheng
All the previous answers are great to explain the reason. Just want to add:
if you do not desire empty string in form and in shell, you probably need
to add a min_length validation condition

On Sun, Aug 9, 2020 at 12:42 PM Stephen J. Butler 
wrote:

> If you look at the documentation for 'blank' it says:
>
> """
> Note that this is different than null. null is purely database-related,
> whereas blank is validation-related. If a field has blank=True, *form
> validation* will allow entry of an empty value. If a field has
> blank=False, the field will be required.
> """
>
> So that is only caught when doing form validation, not when doing model
> validation.
>
>
> On Fri, Aug 7, 2020 at 6:46 AM Juan D.  wrote:
>
>> I've created a model with null and blank set to False in robot_name:
>>
>> class Robot(models.Model):
>> robot_name = models.CharField(max_length=200, null=False, blank=False)
>> version = models.CharField(max_length=20, blank=True, null=True)
>>
>> class Meta:
>> unique_together = ('robot_name', 'version',)
>>
>> On the admin website everything works perfectly and I am not allowed to
>> create a robot without a name. However, on the shell:
>>
>> Robot.objects.create(version="test_version")
>>
>> doesn't raise any Exception.
>>
>> What could it be?
>>
>> --
>> 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/4ff1570e-70a2-495c-82e3-f20d760992d2n%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/CAD4ANxV3r35zB70M4D6s_35PuxUeYay5JQUFuPOfJAA6vovBxQ%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/CAGQ3pf9ve5jj3kVBzXqAm9J86Yq0U57B_iLRnL7SnsTtdGcvfA%40mail.gmail.com.


Re: Django jinja queryset filter lenth

2020-08-09 Thread Liu Zheng
Hi,

Not sure it's a good idea to do database query inside the template.
Templates are capable of running some logics but for a heavy-lifting job
like database query, it should be a good practice to do it in the view, and
only pass the results to the template.

On Sun, Aug 9, 2020 at 4:30 AM Agoua David  wrote:

> As Django template engine do not support the parenthèses you Can try to
> make a custom filter
>
> Le sam. 8 août 2020 à 20:27, Agoua David  a écrit :
>
>> You Can try to use .count instead
>>
>> Le sam. 8 août 2020 à 17:56, N'BE SORO  a écrit :
>>
>>> Good evening please
>>>
>>> Can you help me?
>>>
>>> I want to display the number of items with a filter.
>>> Example:
>>> this call returns 4 elements
>>> {{ item.class.classecours.all|length}}
>>>
>>> at the .all level
>>> make an item.class.classecours.filter(status==True)|length
>>>
>>> --
>>> 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/CAOtSHp_wH9Xy-sf9t%2BMdtWB-bnRX680R9iJwZAnyZXh%3DxV%3De%3Dg%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/CAByCr6iR%2BKojR-csC3Rv5zqYd7mUG4%2B%2BnvEcM_ebZmM%2BceRmsw%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/CAGQ3pf-MmY%2BnNLEZHEyyPGE46%2Bv9s52Vvic2AfhdDGJ36Jwr4g%40mail.gmail.com.