On 12/02/2019 11:47 am, Victor H. Velasquez Rizo wrote:
Yes Mike.
I have done both:

In that case, you need to inspect the database itself using PGAdmin (or similar for other databases) and confirm that the gallery_photos table does indeed have a sort_value column.

If not - as the error message says - then the database might have been rebuilt from a dump taken prior the migration which added sort_value. Or perhaps restored from an earlier backup. In any case, if it doesn't exist you have to make it exist.

I'm assuming this is a development database not in production so one way is to cheat.  If anyone else reading this notices a mistake please jump in and correct it.

Look through the migrations and find the one which first added sort_value. Delete the migrations.AddField() call for sort_value from that migration. Look for any mentions of sort_value in other migrations and get rid of them too. There will also be an AlterTable or Options line referring to sort_value which needs to have sort_value removed.

That will trick the migration system into thinking it doesn't exist. The next time you run makemigrations it will discover a new field sort_value and add it.

There is a potential problem here. If migrations from other apps depend on sort_value things may come unstuck. However, it is a good bet that sort_value was added to adjust a display sequence and won't have wider impact.

This is tricky territory so you should do nothing until you have dumped your database and proved you can restore it. Keep your dump as a pre-sort_value backup.

Go carefully

Good luck

Mike


*python manage.py makemigrations*
/home/vic/dev/scribblitt/scribblitt-app/.env/local/lib/python2.7/site-packages/django/db/models/sql/query.py:1156: RemovedInDjango19Warning: Passing callable argumentsto queryset is deprecated.   value, lookups, used_joins = self.prepare_lookup_value(value, lookups, can_reuse,allow_joins)

*No changes detected*

*python manage.py migrate*
/home/vic/dev/scribblitt/scribblitt-app/.env/local/lib/python2.7/site-packages/django/db/models/sql/query.py:1156: RemovedInDjango19Warning: Passing callable argumentsto queryset is deprecated.   value, lookups, used_joins = self.prepare_lookup_value(value, lookups, can_reuse,allow_joins)

Operations to perform:
  Synchronize unmigrated apps: anymail, filebrowser, staticfiles, admindocs, model_utils, tinymce, messages, widget_tweaks, sitemaps, humanize, django_extensions, rest_framework, storages, debug_toolbar, admin_reorder   Apply all migrations: invoices, general, chunks, makeaword, accounts, images, comic, orders, illustrate, pressroom, sites, write, contenttypes, book, thumbnail, django_comments, tellinstories, sessions, cart, auth, definition, admin, gift_cards, photologue, wordsearch, stationary
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
*Running migrations:*
*  No migrations to apply.*







On Mon, Feb 11, 2019 at 5:42 PM Mike Dewhirst <mi...@dewhirst.com.au <mailto:mi...@dewhirst.com.au>> wrote:

    On 12/02/2019 10:23 am, Victor H. Velasquez Rizo wrote:
    > Hello Mike.
    > I have ran the migrations for PHOLOGUE:
    > *Running migrations:*
    > *  No migrations to apply.*
    >

    Ok, have you done manage.py makemigrations followed by manage.py
    migrate?

    >
    >
    >
    >
    >
    >
    > On Mon, Feb 11, 2019 at 4:02 PM Mike Dewhirst
    <mi...@dewhirst.com.au <mailto:mi...@dewhirst.com.au>
    > <mailto:mi...@dewhirst.com.au <mailto:mi...@dewhirst.com.au>>>
    wrote:
    >
    >     On 12/02/2019 4:31 am, victor rizo wrote:
    >>     Hello everyone.
    >>
    >>     I am desperate trying to find a solution for this issue...
    >>
    >>
    >>       ProgrammingError at /admin/photologue/photo/
    >>
    >>     column photologue_gallery_photos.sort_value does not exist
    >
    >     This says the column "sort_value" does not exist in the table
    >     "gallery_photos".
    >
    >     Column is database-speak for a model field. Your software thinks
    >     the column exists therefore it is a programming error. My best
    >     guess is that you need to do a migration.
    >
    > https://docs.djangoproject.com/en/1.11/topics/migrations/
    >
    >     Cheers
    >
    >     Mike
    >
    >
    >>     LINE 1: ...lery_id", "photologue_gallery_photos"."photo_id",
    >>     "photologu...
    >>
    >>     It is happening every time I try to delete a photo from
    >>     *admin/photologue/photo.*
    >>     *
    >>     *
    >>     *Any help you can provided?*
    >>     *
    >>     *
    >>     *Thank you in advance.*
    >>     --
    >>     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
    <mailto:django-users%2bunsubscr...@googlegroups.com>
    >>     <mailto:django-users+unsubscr...@googlegroups.com
    <mailto:django-users%2bunsubscr...@googlegroups.com>>.
    >>     To post to this group, send email to
    >> django-users@googlegroups.com
    <mailto:django-users@googlegroups.com>
    <mailto:django-users@googlegroups.com
    <mailto:django-users@googlegroups.com>>.
    >>     Visit this group at
    https://groups.google.com/group/django-users.
    >>     To view this discussion on the web visit
    >>
    
https://groups.google.com/d/msgid/django-users/86a16f8d-1680-4418-9f00-d9eb41312dd7%40googlegroups.com
    >>   
     
<https://groups.google.com/d/msgid/django-users/86a16f8d-1680-4418-9f00-d9eb41312dd7%40googlegroups.com?utm_medium=email&utm_source=footer>.
    >>     For more options, visit https://groups.google.com/d/optout.
    >
    >
    >
    > --
    >
    >
    >
    > Atte...,.
    > Vìctor Hugo Velàsquez Rizo
    > Cali - Colombia

-- 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
    <mailto:django-users%2bunsubscr...@googlegroups.com>.
    To post to this group, send email to django-users@googlegroups.com
    <mailto:django-users@googlegroups.com>.
    Visit this group at https://groups.google.com/group/django-users.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/django-users/3ca7d1f7-a15b-03d5-6514-716c397e235f%40dewhirst.com.au.
    For more options, visit https://groups.google.com/d/optout.



--



Atte...,.
Vìctor Hugo Velàsquez Rizo
Cali - Colombia
--
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 <mailto:django-users+unsubscr...@googlegroups.com>. To post to this group, send email to django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFCXTzimx%2BnMPz3-gYgohEsJay5coBrFwOsGPrVGwZLMhrU%2BcQ%40mail.gmail.com <https://groups.google.com/d/msgid/django-users/CAFCXTzimx%2BnMPz3-gYgohEsJay5coBrFwOsGPrVGwZLMhrU%2BcQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4453e646-b9c6-31b9-de31-4a3b67508a12%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to