Django on Jython 2.5 alpha3 unicode characters in templates problem
Hi all, I'm recently playing with Django 1.0.2 on Jython 2.5 alpha3 build. Besides missing os.getcwdu function (which I got over by assigning os.getcwdu= os.getcwd at app init) I have problem with template rendering. When Jython string includes non-ASCII unicode characters (central europe specific letters) then it is not rendered by the template, it is missing in the resulting HTML document. If for eg. I have a = "żźćłśąłł" and {{ a }} in the template then it won't appear. I found that doing a = a.encode('utf-8') helps, so a hot fix for that would be writing own custom filter that would utf-8 encode string and doing something like this: {{ a|utf8 }} . But it is not satisfactory enough for me, does anyone have better idea? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django on Jython 2.5 alpha3 unicode characters in templates problem
I found it works on Jython 2.5 beta0 On 8 Sty, 12:38, naos wrote: > Hi all, > > I'm recently playing with Django 1.0.2 on Jython 2.5 alpha3 build. > Besides missing os.getcwdu function (which I got over by assigning > os.getcwdu= os.getcwd at app init) I have problem with template > rendering. > > When Jython string includes non-ASCII unicode characters (central > europe specific letters) then it is not rendered by the template, it > is missing in the resulting HTML document. If for eg. I have a = > "żźćłśąłł" and {{ a }} in the template then it won't appear. > > I found that doing a = a.encode('utf-8') helps, so a hot fix for that > would be writing own custom filter that would utf-8 encode string and > doing something like this: {{ a|utf8 }} . But it is not satisfactory > enough for me, does anyone have better idea? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
admin media and template override ignored after switch to 1.2rc
Hi All, Today I tried to switch my project from 1.0.4 to 1.2rc version and I encountered problem with admin media definitions and template override. It simply doesn't work :) JS,CSS files are not included in the html and all template customizations are not present, looks like my custom templates are not loaded anymore. Does anyone have similar problem? Any solutions? Greetings, Lukasz -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: admin media and template override ignored after switch to 1.2rc
Well now I think that it might be related to virtualenv since I created new virtualenv with Django 1.1.1 and have the same result. On May 17, 12:44 pm, naos wrote: > Hi All, > > Today I tried to switch my project from 1.0.4 to 1.2rc version and I > encountered problem with admin media definitions and template > override. It simply doesn't work :) JS,CSS files are not included in > the html and all template customizations are not present, looks like > my custom templates are not loaded anymore. > > Does anyone have similar problem? Any solutions? > > Greetings, > Lukasz > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
IntegrityError: foreign key violation upon delete
Hi all, I have problem with foreign key contraint upon calling delete() on my model. Here's my problem: I have Order and Shipment model. Shipment has a foreign key to Order. class Order(...): ... class Shipment() order = m.ForeignKey('Order') ... Now in one of my views I want do delete order object along with all related objects. So I invoke order.delete(). I have Django 1.0.4, PostgreSQL 8.4 and I use transaction middleware, so whole request is enclosed in single transaction. The problem is that upon order.delete() I get: ... File "/usr/local/lib/python2.6/dist-packages/django/db/backends/ __init__.py", line 28, in _commit return self.connection.commit() IntegrityError: update or delete on table "main_order" violates foreign key constraint "main_shipment_order_id_fkey" on table "main_shipment" DETAIL: Key (id)=(45) is still referenced from table "main_shipment". I checked in connection.queries that proper queries are executed in proper order. First shipment is deleted, after that django executes delete on order row: {'time': '0.000', 'sql': 'DELETE FROM "main_shipment" WHERE "id" IN (17)'}, {'time': '0.000', 'sql': 'DELETE FROM "main_order" WHERE "id" IN (45)'} Foreign key have ON DELETE NO ACTION (default) and is initially deferred. I don't know why I get foreign key constraint violation. I also tried to register pre_delete signal and manually delete shipment objects before delete on order is called, but it resulted in the same error. I can change ON DELETE behaviour for this key in Postgres but it would be just a hack, I wonder if anyone has a better idea what's going on here. There is also a small detail, my Order model inherits from Cart model, so it actually doesn't have id field but cart_ptr_id and after DELETE on order is executed there is also DELETE on cart, but it seems unrelated? to the shipment->order problem so I simplified it in the example. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: IntegrityError: foreign key violation upon delete
Problem has been solved and it doesn't have connection to any bugs, it was just programming error (there was shipment.save() somewhere later in python code) On Mar 30, 10:21 am, naos wrote: > Hi all, > > I have problem with foreign key contraint upon calling delete() on my > model. Here's my problem: > > I have Order and Shipment model. Shipment has a foreign key to Order. > > class Order(...): > ... > > class Shipment() > order = m.ForeignKey('Order') > ... > Now in one of my views I want do delete order object along with all > related objects. So I invoke order.delete(). > > I have Django 1.0.4, PostgreSQL 8.4 and I use transaction middleware, > so whole request is enclosed in single transaction. > The problem is that upon order.delete() I get: > > ... > File "/usr/local/lib/python2.6/dist-packages/django/db/backends/ > __init__.py", line 28, in _commit > return self.connection.commit() > > IntegrityError: update or delete on table "main_order" violates > foreign key constraint "main_shipment_order_id_fkey" on table > "main_shipment" > DETAIL: Key (id)=(45) is still referenced from table "main_shipment". > > I checked in connection.queries that proper queries are executed in > proper order. > First shipment is deleted, after that django executes delete on order > row: > > {'time': '0.000', 'sql': 'DELETE FROM "main_shipment" WHERE "id" IN > (17)'}, > {'time': '0.000', 'sql': 'DELETE FROM "main_order" WHERE "id" IN > (45)'} > > Foreign key have ON DELETE NO ACTION (default) and is initially > deferred. I don't know why I get foreign key constraint violation. > > I also tried to register pre_delete signal and manually delete > shipment objects before delete on order is called, but it > resulted in the same error. I can change ON DELETE behaviour for this > key in Postgres but it would be just a hack, > I wonder if anyone has a better idea what's going on here. > > There is also a small detail, my Order model inherits from Cart model, > so it actually doesn't have id field but cart_ptr_id > and after DELETE on order is executed there is also DELETE on cart, > but it seems unrelated? to the shipment->order > problem so I simplified it in the example. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.