Discussion:
How to customize table name for model classes and still use django managed tables
Alexander Lamas
2018-08-21 07:09:52 UTC
Permalink
Hi All,

I'm not sure if this is a discussion for this group.

I wonder if there is a way to stop django/python from adding the prefix
"myapp" for all tables it creates when migrating.

I managed to use db_column='ColumnName' and now my tables have the column
name I want, but, using db_table inside of my Meta class doesn't help
anything.

I still want to keep Django to manage everything, but, not the table
naming. :)

Thanks in advance!

Alex
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jani Tiainen
2018-08-21 07:54:53 UTC
Permalink
Hi,

db_table in model Meta should definitely change table name (after
migrations of course). Maybe you made some kind of a typo and it didn't
worked.


On Tue, Aug 21, 2018 at 10:09 AM, Alexander Lamas <
Post by Alexander Lamas
Hi All,
I'm not sure if this is a discussion for this group.
I wonder if there is a way to stop django/python from adding the prefix
"myapp" for all tables it creates when migrating.
I managed to use db_column='ColumnName' and now my tables have the column
name I want, but, using db_table inside of my Meta class doesn't help
anything.
I still want to keep Django to manage everything, but, not the table
naming. :)
Thanks in advance!
Alex
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Alexander Lamas
2018-08-21 08:08:37 UTC
Permalink
Hi Jani,

Thanks for your reply.

Actually yes, I did the migration using the db_table and it worked as I was
planning.

I was just afraid of my unit tests, but, it seems all is working as it
should.

Thanks for your reply though.

Cheers,
Alex
Post by Jani Tiainen
Hi,
db_table in model Meta should definitely change table name (after
migrations of course). Maybe you made some kind of a typo and it didn't
worked.
On Tue, Aug 21, 2018 at 10:09 AM, Alexander Lamas <
Post by Alexander Lamas
Hi All,
I'm not sure if this is a discussion for this group.
I wonder if there is a way to stop django/python from adding the prefix
"myapp" for all tables it creates when migrating.
I managed to use db_column='ColumnName' and now my tables have the column
name I want, but, using db_table inside of my Meta class doesn't help
anything.
I still want to keep Django to manage everything, but, not the table
naming. :)
Thanks in advance!
Alex
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Jani Tiainen
- Well planned is half done, and a half done has been sufficient before...
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...