Tuesday, July 27, 2021

Re: help creating foreign Key relationship in DRF

Take the create method out of the meta class 

Let's start with that first. 

Best regards

Stephen Oba

On Tue, Jul 27, 2021, 1:03 PM ola neat <tosinayoola0@gmail.com> wrote:
halo i'm working on creating a foreignKey kinda relationship between multiple table but im getting an err
can anyone help
below is my code & err screenshot






--
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/CAHLKn717ia96CZ%2BnSnXKjz3ubj6JyUUrGrZEbAS9qC2NGMJpAw%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAJsLnrmi%3DFmPu9LvA5YoS73o-GAUAb4w1%3Dty8gv3EyXvKiCQw%40mail.gmail.com.

help creating foreign Key relationship in DRF

halo i'm working on creating a foreignKey kinda relationship between multiple table but im getting an err
can anyone help
below is my code & err screenshot






--
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/CAHLKn717ia96CZ%2BnSnXKjz3ubj6JyUUrGrZEbAS9qC2NGMJpAw%40mail.gmail.com.

Monday, July 26, 2021

Re: Please remove me from this user group.

Farewell. 

On Mon, Jul 26, 2021 at 22:16 Shirley Nelson <star2jem@gmail.com> wrote:
Please remove me from this user group. Thank you.

Regards, Shirley Nelson

--
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/CA%2BN15oZhNz6SYsnN1tiBoyjyn-8nM0tfQ2Ua1MWSrVJTdiWa8A%40mail.gmail.com.
--
Sent from Gmail Mobile

--
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/CAJoAtSnoRK61-z8Lh1-rd2CmKhqYU%2BCo%3D%3D%3DHaaaP8%2BcuO5GokA%40mail.gmail.com.

Please remove me from this user group.

Please remove me from this user group. Thank you.

Regards, Shirley Nelson

--
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/CA%2BN15oZhNz6SYsnN1tiBoyjyn-8nM0tfQ2Ua1MWSrVJTdiWa8A%40mail.gmail.com.

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

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 <sali...@rohteksolutions.com> 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 <amanv...@gmail.com> 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.

--
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/f8458021-e0c0-4c30-8188-0c08932b1deen%40googlegroups.com.

OperationalError: foreign key mismatch

Hello,

I'm getting the following error whenever I attempt to save to the table in a SQLite database:

foreign key mismatch - "procedure_tbl" referencing "filename_tbl"

In models.py, these are the tables that the error is refering to:

class FilenameTbl(models.Model):
    rowid = models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='FileID', db_column='rowid')
    filename = models.TextField(blank=True, null=True)
    creation_datetime = models.TextField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'filename_tbl'
        ordering = ['rowid']


class ProcedureTbl(models.Model):
    rowid = models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ProcedureID', db_column='rowid')
    ...
    filename_id = models.ForeignKey(FilenameTbl,db_column='filename_id', to_field='rowid',null=True,blank=True,on_delete=models.SET_NULL)

    class Meta:
        managed = False
        db_table = 'procedure_tbl'
        ordering = ['rowid']

Data can be read from the tables and querysets like the following return the correct data:
    queryset = FilenameTbl.objects.values(
        'rowid', 'filename',
        'proceduretbl__rowid')

Raw SQLite commands to write/update to the ProcedureTbl table function properly.

If I removed filename_id from the ProcedureTbl, then data can be saved to the table.

Any insight into the issue would be much appreciated.

Cheers,
Wai



--
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/b90d237f-8c29-42ef-897a-34221704699dn%40googlegroups.com.

What is the necessity of success_url_allowed_hosts on a LogoutView?

success_url_allowed_hosts: A set of hosts, in addition to request.get_host(), that are safe for redirecting after logout. Defaults to an empty set.

What could go wrong if evilwebsite.com is included in success_url_allowed_hosts?

--
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/7f6ee52c-de74-4ca0-8e70-cd97d577cc54n%40googlegroups.com.