Re: Added new column to model and run migrations but not applied to database table

2021-08-15 Thread Salima Begum
Hi,
I am hitting this problem again with new code merges into the
deployment server. Last time, I fixed the issue by doing like this

"I have tried all the ways what you guys suggested me But here I don't want
change database why because it is deployment server so, when I run
manage.py makemigrations migrations are applied and changes are reading but
when I run manage.py migrate changes are not taken to database so, Manually
I queried queries to add columns into respected tables into database."

I really think this might not be a sustainable solution. So, I would really
like to fix this permanently. I would appreciate it if someone could
suggest a remedy for this issue.

Thank you in advance
~Salima

On Tue, Jul 27, 2021 at 5:18 AM guna visva  wrote:

> having had the unfortunate phase of dealing with it , sorting it requires
> some patience
>
> the issue is the tables in django_migrations is not in sync with rest the
> rest of your database or migrations files.
>
> You have to first remove the addition in field etc and make sure the
> database tables are first in sync with your models, then 1. delete
> migrations files and 2. delete django_migrations. Then 3.makemigrations and
> 4. migrate fake.  All risks are yours to take
>
> Then finally just add your fields and makemigrations and migrate
>
> The above might/or not work as it might give some content type errors
>
>
>
>
> On Wednesday, July 21, 2021 at 2:39:56 AM UTC+8 sebasti...@gmail.com
> wrote:
>
>> Is in settings.py also in installed app? Without that migrations don't
>> work
>>
>> Salima Begum  schrieb am Di., 20. Juli
>> 2021, 19:00:
>>
>>> Hi ,
>>> Thank you for your responses.
>>>  I have tried all the ways Which you people suggested I am not getting
>>> any error while running makemigrations or migrate and
>>> python manage.py migrate --fake-initial. But those migrations are not
>>> applying to the database. How can I fix this issue without deleting the
>>> database?
>>>
>>> Thank you
>>> ~Salima
>>>
>>>
>>> On Mon, Jul 19, 2021 at 7:02 PM Aman Vyas  wrote:
>>>
 if it is saying no changes detected while running makemigrations and
 you are sure that you changed models.py  then these things you can try:

 1: python manage.py makemigrations appname

 if this will not work then do that

 2: delete migrations folder from your app and delete database then run
 again python manage.py makemigrations




 On Mon, Jul 19, 2021 at 6:07 AM Salima Begum <
 sali...@rohteksolutions.com> wrote:

> Hi all,
>
> I have added a new column to the existing model while developing. Then
> I run makemigrations and migrate. It is not applied to the database table
> which is created based on that model. How can I fix this issue? Please 
> help
> me to complete this issue.
>
> The below issue I am facing in deployment server after adding new
> field and deployed into server.
>
> ```
> psycopg2.errors.UndefinedColumn: column
> shopping_ls_product_search.quality_prdct does not exist
> LINE 1: ... Col1 FROM "shopping_ls_product_search" WHERE ("shopping_...
> ```
> Thank you
> ~Salima
>
> --
> 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/CAMSz6bnLkeN001UnxO3PdCg06Jc%3Dcr22kZXc71KL4w5CbYq_Cw%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...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAKZY6%3DAgrWzCmrBHpouSJG_Vfy7i6LQu81Q7EWBRq44Yf3053A%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...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMSz6bmQ5KAQ2SFHCMbf8UHkg34itZPFZ1OksP-2C3t5wAwTJQ%40mail.gmail.com
>>> 
>>> .
>>>
>> --
> You received this message because you are 

Re: startproject doesn't working

2021-08-15 Thread MR INDIA

Try this 
https://stackoverflow.com/questions/31379431/django-admin-startproject-mysite/31379534
  
On Saturday, 14 August 2021 at 23:51:26 UTC+5:30 s2o...@outlook.kr wrote:

> Hi 
> Does anybody know why startproject doesn't work?
>
> django-admin startproject mysite
>
> I tried this, but it does not work and keep says 'invalid syntax' at 
> 'startproject'
>

-- 
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/f585e96d-1050-4b6d-8aea-ee156b2ab876n%40googlegroups.com.


Re: GeoDjango with SpatialLite on Windows 10

2021-08-15 Thread Tugg Speedman
OK, I got it.

As it turns out, GDAL has everything you need, including the SQLite 
database. There is only one important fact, you have to load the DLL prior 
Django loads his SQLite. Because Django loads the one from Python it self. 
Therefore i did put the necessary code into the settings.py. Because Django 
has first to load the settings, before it can load the correct database 
middleware (SQLite, PostgreSQL, MariaDB,...). The code is in the Picture 
below.

P.S.: The Tutorial is not quiet accurate. The Geographic Model from there 
(https://docs.djangoproject.com/en/3.2/ref/contrib/gis/tutorial/#defining-a-geographic-model)
 
should allow NULL for the polygon field:
mpoly = models.MultiPolygonField(null=True)
This is neccessary because the ZIP you offer there has incomplete data. At 
least good old England (to be precise: United Kingdom) has no pylogon data, 
maybe some more countries. I didn't check further. Therefore you can't load 
the "TM_WORLD_BORDERS-0.3.shp" as instructed 
(https://docs.djangoproject.com/en/3.2/ref/contrib/gis/tutorial/#layermapping).

Should I open a ticket for this, or is this mailing list enough?
[image: settings.png]
Tugg Speedman schrieb am Freitag, 13. August 2021 um 18:41:22 UTC+2:

> Ah OK, this was helpful. I never thought about this, but as it turns out 
> on Windows, Python ships with it's own compiled version of SQLite (see 
> picture below). This is problematic. If i just swap this DLL with another 
> one, I would change every other Python Script on my machine. Hmm..., is it 
> possible to change some environment Paths in a venv and just point to 
> another DLL? I have to look this up. Thanks a lot Micheal.
>
> [image: sqlite.png]
>
> Michael Ross schrieb am Freitag, 13. August 2021 um 00:51:02 UTC+2:
>
>> On Thu, 12 Aug 2021 04:15:57 -0700 (PDT)
>> Tugg Speedman  wrote:
>>
>> > 
>> > Hello everyone,
>> > 
>> > I'm new to GeoDjango and therefore I tried to follow the tutorial 
>> > (https://docs.djangoproject.com/en/3.2/ref/contrib/gis/tutorial/) 
>> first. 
>> > But the problem is, it doesn't work with SQLite a.k.a SpatialLite. When 
>> I 
>> > try to build the migrations, a Windows error pops up (see picture 
>> below). 
>> > It's german and says there is no entry point in gdal301.dll.
>> > 
>> > So why do I post this problem here in Django mailing list? Because the 
>> > Tutorial is very fuzzy for Spatial & Windows. It basically just says 
>> > download the SQLite files from here: https://www.gaia-gis.it/gaia-sins/
>> > 
>> > But what to do with this files? Can I put them wherever I want? Do I 
>> have 
>> > to add them on System/Python path?
>> > 
>> > I would really appreciate any help
>> > Thank you[image: error.png]
>>
>> Maybe this helps:
>>
>>
>> https://stackoverflow.com/questions/53682315/error-on-libcurl-dll-when-using-gdal-of-osgeo4w-in-django
>>
>> TLDR: IntelliJ loads wrong sqlite3.dll?
>>
>> -- 
>> Michael Ross 
>>
>

-- 
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/e0fb9baa-dbcb-4d6a-a566-a91c7b8d362cn%40googlegroups.com.


Re: roles and permissions

2021-08-15 Thread Abeer Eltanawy
Sorry, this is the link:
https://testdriven.io/blog/drf-permissions/#drf-permissions

On Sun, Aug 15, 2021 at 6:26 AM Lalit Suthar 
wrote:

> https://www.django-rest-framework.org/api-guide/permissions/
>
> On Sat, 14 Aug 2021 at 04:35, Mike Dewhirst  wrote:
>
>> Have you looked at ...
>>
>> https://simpleisbetterthancomplex.com/tutorial/2018/01/18/how-to-implement-multiple-user-types-with-django.html
>>
>>
>>
>>
>> --
>> (Unsigned mail from my phone)
>>
>>
>>
>>  Original message 
>> From: Amit Vaghani 
>> Date: 13/8/21 23:28 (GMT+10:00)
>> To: Django users 
>> Subject: roles and permissions
>>
>> I want develop Custom Roles And Permission
>> Any one guide me
>>
>> --
>> 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/8a8babc1-445c-416a-9abd-de75bec61a38n%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/6116fa87.1c69fb81.1604d.c2a5SMTPIN_ADDED_MISSING%40gmr-mx.google.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/CAGp2JVGTet_Gic0OthOhPPoOw8%3D%3DsQ2eN49pNC_xVRm5s9MYZQ%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/CACbngZeOvta-6k1jUky9aQBzhNxTGQU%2BhvCfSsX%3Dv1JhW6QD%2Bw%40mail.gmail.com.