Pk
Hello , I update from django 2 to 3.0 and it show me "python_2_unicode_compatible" error any solution for this
Nonverbis
Hello , I update from django 2 to 3.0 and it show me "python_2_unicode_compatible" error any solution for this
Django 3 doesn't support Python 2 (https://docs.djangoproject.com/en/3.0/faq/install/#what-python-version-can-i-use-with-django). So, use python 3 only.
Ghorz
Hello , I update from django 2 to 3.0 and it show me "python_2_unicode_compatible" error any solution for this
Unicode is backward compatible with python 2. Django 3 is entirely on py3. Eliminate instances of unicode
Ghorz
Hello , I update from django 2 to 3.0 and it show me "python_2_unicode_compatible" error any solution for this
Replace def unicode(self): return u'%s' % self.lname With def str(self): return u'%s' % self.lname
Ghorz
Telegram removed the double underscore, remove u before the ''
Mirco
__your_welcome__
Ghorz
_x_
Doragonsureiyā
Telegram removed the double underscore, remove u before the ''
Please, use Markdown style to share code `print("inline fixed-width code")` #singleline ```print("pre-formatted fixed-width code block")``` #multiline For a detailed guide see follow this link
Jb
AttributeError at /cart/ 'Order' object has no attribute 'orderitems_set' please help
Jb
check for typos
def cart(request): if request.user.is_authenticated: customer = request.user.customer order, created = Order.objects.get_or_create( customer=customer, complete=False) items = order.orderitems_set.all() else: items = [] context = {'items': items} return render(request, 'store/cart.html', context)
Xavier
it's always small unless u set related_name param
Jb
Not working
Ghorz
Not working
Check the source you copied, spy with both eyes wide open.
محمد دلشاد
nope
its with the child model but parent model should have its proper naming convension
محمد دلشاد
as i can remind myself
Xavier
its with the child model but parent model should have its proper naming convension
yea that's there, but he is using _set so it's a child model probably
محمد دلشاد
nope
u r right sorry
D
Does Order.objects.get_or_create(customer=customer, complete=False) return 2 values? I mean ( order, created = ) Didn't know that > yes: object and bool
محمد دلشاد
Does Order.objects.get_or_create(customer=customer, complete=False) return 2 values? I mean ( order, created = ) Didn't know that > yes: object and bool
Yes and either it will return the object for the related query or it will create a new one with the credentials
Hariom
Hello everyone
Hariom
Anyone have idea about live-streaming and saving the same video ?
Hariom
Please let me know
Hariom
Any suggestions is appreciating
Hariom
It’s all requirement on web
Hariom
Thanks in advance
Scrim
Hello all, i dropped one table directly on my database, so now, when i try makemigrations and migrate, this table not create again
Scrim
how can i create this table automaticly again ??? my system stopped
Xavier
Hello all, i dropped one table directly on my database, so now, when i try makemigrations and migrate, this table not create again
is it showing errors or it's just not performing the migration and pretending that it performed the migrations?
Scrim
not perform
Scrim
just appear
Scrim
Running migrations: No migrations to apply.
Scrim
i did it
Xavier
Scrim
same
Scrim
dont create table again
Scrim
the table that i dropped manually
Xavier
the table that i dropped manually
check with the shell if the table is there
Xavier
if not then do this
Xavier
delete all migration in migrate file except init.py
Xavier
then makemigrations again
Scrim
i did it too
Scrim
yes... i did it
Scrim
but the specific table that i dropped manually on database
Xavier
yes... i did it
well...... it's simply not detecting it
Scrim
not create again
Xavier
create that table manually
Xavier
then try adding a test table and makemigrations
Xavier
then try adding a test table and makemigrations
to check for errors in migration
Scrim
just table ?
Xavier
just table ?
juts test table then delete it
Xavier
or add a field somewhere
Xavier
doesn't matter just check if the migration is working
coderss
Restart your software then... Sometimes it effects too
Scrim
i did it
Scrim
restart
Scrim
and nothing
Xavier
i did it
add that table manually
Xavier
cuz it's not recorded in the migration as u have done it manually
Xavier
weird
Scrim
how
Sarthak
I have a query; I would be using a explicitly defined primary key field in my user table, what I want is to attach a number like '111'+ i as the primary key where i is auto incremented... but if the server stops by some chance, I would have to reload i, so I would have to save the value of i in database after each run also i would be reading i each time from database Concerns: 1. What if before i is saved server crashes, so the value of I would be corrupted 2. If I has been read once, can I be able to not read it at each run My use case is : 1. I have one US server which is seperated by UK server, but I want to have a global server too where US and UK users are both present
D
how
if deleting all is not a problem (I asume because you deleted migrations) — did you try do delete DB and then create it again? what database you use? Postgres?
D
how
I mean I hope it's your dev DB, isn't it?
Scrim
isnt't
Scrim
if dev db, i can delete all
Scrim
and recreate