Does the bulk delete check the permissions correctly?

2015-10-30 Thread Szymon Pyzalski
Hello!

According to the documentation, the behaviour of has_delete_permission
should look like this:

If obj is None, should return True or False to indicate whether deleting
objects of this type is permitted in general (e.g., False will be
interpreted as meaning that the current user is not permitted to delete
any object of this type).

I was amazed therefore when I saw that when this method returns True for
object=None, the *any bulk delete is possible*. This leads to a very
nonintuitive situation, where it is impossible to delete an object
directly, but it is possible to include it in a bulk to delete. Is it
the desired behaviour? Is it possible to check permissions for all
objects in bulk? If no, there should be a big fat warning about it in
the documentation.

Greetings
Szymon

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5633B5A2.1010207%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: please help: problem saving strings to the database

2014-11-21 Thread Szymon Krzemiński
Looks like the record is stored as a one-element tuple. Don't know what's 
the source of this behaviour yet, though.

W dniu piątek, 21 listopada 2014 12:57:40 UTC+1 użytkownik Sabine Maennel 
napisał:
>
> Hello,
>
> I do not know why this is happening: If I try to update a database record 
> the text gets into the field the wrong way:
>
> models.py
>
> from model_utils.models import TimeStampedModel
>
> class ClassroomLog(TimeStampedModel):
> ...
> text = models.TextField()
>
> then somewhere else I put data in that database like that:
>
> ...
> log = ClassroomLog.objects.get(...)
> log.text = "Hallo"
> log.save()
>
> then the field in the database will contain this:
>
> ('Hallo',) 
>
> What am I doing wrong here?
>
> If I do this instead: 
>
> ...
> log = ClassroomLog.objects.get(...)
> log.delete()
> log = ClassroomLog(..., text = "Hallo", ...)
> log.save()
>
> it works out as expected and the admin of the database shows for 
> list_display = ('text',): 
>
> Hallo  
>
> Can someone please help me with this. I tried for quite a while, but could 
> not figure out what is happening.
>
>  with kind regards and thanks in advance
>  Sabine
>
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/69db39c8-0fb5-4d6a-8fe2-58883075b966%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


get_or_create failuire

2010-09-28 Thread Szymon
Hi,

Problem: sometimes (not always) get_or_create is trying to create
duplicated record.

Model:

class online(models.Model):
 postac = models.OneToOneField('postac.postacie',
related_name="lista_online")
 data = models.DateTimeField()

Code snippet:

o =
online.objects.filter(postac__user=request.user).exclude(postac=request.session['postac'])
o.delete()
o, c = online.objects.get_or_create(postac=request.session['postac'],
defaults={ 'data' : datetime.now()+timedelta(minutes=15) })
if not c:
o.data = datetime.now()+timedelta(minutes=15)
o.save()

Database schema:

  Column   |   Type   |
Modifiers
---+--
+-
 id| integer  | not null default
nextval('spoleczniak_online_id_seq'::regclass)
 postac_id | integer  | not null
 data  | timestamp with time zone | not null
Indexes:
"spoleczniak_online_pkey" PRIMARY KEY, btree (id)
"spoleczniak_online_postac_id_key" UNIQUE, btree (postac_id)
Foreign-key constraints:
"spoleczniak_online_postac_id_fkey" FOREIGN KEY (postac_id)
REFERENCES postac_postacie(id) DEFERRABLE INITIALLY DEFERRED


PostgreSQL error:

Sep 28 12:35:42 postgres postgres[7238]: [2-1] ERROR:  23505:
duplicate key value violates unique constraint
"spoleczniak_online_postac_id_key"
Sep 28 12:35:42 postgres postgres[7238]: [2-2] DETAIL:  Key
(postac_id)=(109387) already exists.
Sep 28 12:35:42 postgres postgres[7238]: [2-3] LOCATION:
_bt_check_unique, nbtinsert.c:388
Sep 28 12:35:42 postgres postgres[7238]: [2-4] STATEMENT:  INSERT INTO
"spoleczniak_online" ("postac_id", "data") VALUES (109387,
E'2010-09-28 12:50:40.813883')

Database of course is PostgreSQL, Django 1.2.3 (btw. nice version
number :)), psycopg2 ... what else? So, am I doing something wrong?

-- 
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.



Best solution for remote static content server?

2010-05-24 Thread Szymon
Hello,

What's the best solution for dispatching static (uploaded/generated by
PIL) content to another server? NFS? What I need/want:

a) I need to store uploaded files and generated by PIL (Image.save('/
path/foo/bar.png')),
b) I want to serve it via nginx.

In early version of Django book I saw that there is NFS listed as best
solution for this, but in newest there is no recommendation at all.
Any disadvantages of using NFS?

Best regards,
Szymon

-- 
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: Problem with memcache - very bad performance

2010-02-23 Thread Szymon
Hello again,

I've changed backend to pylibmc (using some custom backend found in
Google, that needed some changes to work) , installed Memcached on
local WWW box (it was on DB box before), connecting via socket...
and...

2.5%   0.009 /home/www/dev/mc.py

But we will see in few hours, when traffic will be heavy (now is light/
moderate).

Best regards,
Szymon

-- 
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: Problem with memcache - very bad performance

2010-02-22 Thread Szymon
Hello,

I've turned -vv logging and sometimes it throws:

>18 ERROR
<18 ccopy_reg
>18 ERROR
<18 _reconstructor
>18 ERROR
<18 p1
>18 ERROR
<18 (cdjango.db.models.query
>18 ERROR
<18 QuerySet
>18 ERROR
<18 p2
>18 ERROR
<18 c__builtin__
>18 ERROR
<18 object
[snip - it's long]

Some problem with caching QuerySets?

-- 
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: Problem with memcache - very bad performance

2010-02-22 Thread Szymon
On 22 Lut, 22:50, Javier Guerra  wrote:
> are you sure you get memcached store on RAM? maybe it's being swapped out

Yes. Swap hasn't been touched yet since last reboot.

Mem: 400M Active, 2915M Inact, 354M Wired, 66M Cache, 214M Buf, 193M
Free
Swap: 4000M Total, 4000M Free

But that's strange:

# netstat | grep localhost.11211 | wc -l
652

It's ok? Almost all in "TIME_WAIT" state. Now, when there is really
small traffic.

-- 
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: Problem with memcache - very bad performance

2010-02-22 Thread Szymon
On 22 Lut, 21:15, Szymon <szy...@mwg.pl> wrote:
> 5 secs.

CPU secs. of course.

Now, on lighter traffic (same view).

12.1%   0.069 build/bdist.freebsd-7.1-RELEASE-amd64/egg/memcache.py

Strange. Probably on higher load I will get faster response times just
querying DB. :S Any suggestions? Maybe it's normal?

-- 
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.



Problem with memcache - very bad performance

2010-02-22 Thread Szymon
Hi,

I'm using latest Django trunk and have problems with memcache. For few
days my site is struggling with performance. I've blamed mod_wsgi,
I've blamed Apache, I've blamed Postgres on dedicated box, I've blamed
everything but today I've done profiling... and the winner is...

72.1%   4.862 build/bdist.freebsd-7.1-RELEASE-amd64/egg/memcache.py

5 secs. (!) 72% of execution time. Something that should boost
performance, kills my WWW box! There were about 30-40 calls.

It's not normal? What can cause problem? There are no any infos in
logs. Nothing. :S

Best regards,
Szymon Kosok

-- 
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.



Deadlock detected

2009-10-15 Thread Szymon

Hello,

Sometimes Django (on higher loads) throws exception:

TransactionRollbackError: deadlock detected
DETAIL:  Process 58214 waits for ShareLock on transaction 121403425;
blocked by process 58200.
Process 58200 waits for ShareLock on transaction 121403482; blocked by
process 58214.
HINT:  See server log for query details.
CONTEXT:  SQL statement "SELECT 1 FROM ONLY "public"."postac_postacie"
x WHERE "id" OPERATOR(pg_catalog.=) $1 FOR SHARE OF x"

Any suggestions? Apache + mod_wsgi + Postgres.
--~--~-~--~~~---~--~~
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: Records doesn't sometimes get upated

2009-09-22 Thread Szymon

On 21 Wrz, 22:47, Javier Guerra  wrote:
> only if you include it in the parameter list:

Oh, yes. I forget about self in my example, but in function that makes
problem there is of course self in parameter list.
--~--~-~--~~~---~--~~
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: Records doesn't sometimes get upated

2009-09-21 Thread Szymon

Yes.

self.bar += c
self.save()

Isn't "self" refers to existing object?

On 21 Wrz, 16:18, phoebebright <phoebebri...@spamcop.net> wrote:
> The code looks like it only handles the case of adding a new foo
> object but your comments refer to "old values".  Are you also
> expecting this to work for an update?
>
> On Sep 21, 7:35 am, Szymon <szy...@mwg.pl> wrote:
>
>
>
> > Hello,
>
> > I have strange problem. I will give example. I have model:
>
> > class foo(models.Model)
> >  bar = models.IntegerField()
>
> > and method in it
>
> >  def add_bar(c):
> >   from something.models import bar_log
> >   b = bar_log(foo=self, cnt=c)
> >   b.save()
> >   self.bar += c
> >   self.save()
>
> > ... and now the problem. Sometimes "bar" in "foo" doesn't get updated.
> > There is record in bar_log, but "bar" in "foo" have old value. How can
> > I trace problem? There are no exceptions at all.
>
> > I'm using Django 1.1, Postgresql with psycopg2 as interface. There are
> > two parts of my application - web interface and daemonized part that
> > runs some background tasks every 5 seconds.
>
> > Best regards,
> > Szymon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Records doesn't sometimes get upated

2009-09-21 Thread Szymon

Hello,

I have strange problem. I will give example. I have model:

class foo(models.Model)
 bar = models.IntegerField()

and method in it

 def add_bar(c):
  from something.models import bar_log
  b = bar_log(foo=self, cnt=c)
  b.save()
  self.bar += c
  self.save()

... and now the problem. Sometimes "bar" in "foo" doesn't get updated.
There is record in bar_log, but "bar" in "foo" have old value. How can
I trace problem? There are no exceptions at all.

I'm using Django 1.1, Postgresql with psycopg2 as interface. There are
two parts of my application - web interface and daemonized part that
runs some background tasks every 5 seconds.

Best regards,
Szymon
--~--~-~--~~~---~--~~
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: "No results to fetch" on save

2009-07-09 Thread Szymon

Hi again,

I think I got it... I had "TransactionMiddleware" enabled and
'autocommit' set to True... When I deleted 'autocommit' exception is
gone.

Regards,
Szymon

On 9 Lip, 13:35, Szymon <szy...@mwg.pl> wrote:
> Hi,
>
> I'm lost. Maybe someone here will help me:
>
> Model:
>
> class obrazki(models.Model):
>
>     obrazek = models.ImageField(upload_to="upload/%y/%m/%d/")
>     slug = models.SlugField(max_length=200)
>     tytul = models.CharField(max_length=100)
>     tagi = TagField(null=True)
>     data = models.DateTimeField()
>
> Source:
>
> [...]
>
> formularz = fzdjecie(request.POST, request.FILES)
>
>         if formularz.is_valid():
>
>             o = obrazki(tytul=formularz.cleaned_data['tytul'],
> slug=slug(formularz.cleaned_data['tytul']), data=datetime.now(),
> tagi=formularz.cleaned_data['tagi'])
>
>             o.save()
>
> [...]
>
> Exception:
>
> Traceback (most recent call last):
>
>  File "/usr/local/lib/python2.6/site-packages/django/core/handlers/
> base.py", line 92, in get_response
>    response = callback(request, *callback_args, **callback_kwargs)
>
>  File "/home/pikczur/app/root/glowna.py", line 35, in index
>    o.save()
>
>  File "/usr/local/lib/python2.6/site-packages/django/db/models/
> base.py", line 410, in save
>    self.save_base(force_insert=force_insert,
> force_update=force_update)
>
>  File "/usr/local/lib/python2.6/site-packages/django/db/models/
> base.py", line 495, in save_base
>    result = manager._insert(values, return_id=update_pk)
>
>  File "/usr/local/lib/python2.6/site-packages/django/db/models/
> manager.py", line 177, in _insert
>    return insert_query(self.model, values, **kwargs)
>
>  File "/usr/local/lib/python2.6/site-packages/django/db/models/
> query.py", line 1087, in insert_query
>    return query.execute_sql(return_id)
>
>  File "/usr/local/lib/python2.6/site-packages/django/db/models/sql/
> subqueries.py", line 324, in execute_sql
>    return self.connection.ops.fetch_returned_insert_id(cursor)
>
>  File "/usr/local/lib/python2.6/site-packages/django/db/backends/
> __init__.py", line 171, in fetch_returned_insert_id
>    return cursor.fetchone()[0]
>
> ProgrammingError: no results to fetch
>
> Latest Django trunk, Postgres 8.4.
>
> Best regards,
> Szymon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



"No results to fetch" on save

2009-07-09 Thread Szymon

Hi,

I'm lost. Maybe someone here will help me:

Model:

class obrazki(models.Model):

obrazek = models.ImageField(upload_to="upload/%y/%m/%d/")
slug = models.SlugField(max_length=200)
tytul = models.CharField(max_length=100)
tagi = TagField(null=True)
data = models.DateTimeField()

Source:

[...]

formularz = fzdjecie(request.POST, request.FILES)

if formularz.is_valid():

o = obrazki(tytul=formularz.cleaned_data['tytul'],
slug=slug(formularz.cleaned_data['tytul']), data=datetime.now(),
tagi=formularz.cleaned_data['tagi'])

o.save()

[...]

Exception:

Traceback (most recent call last):

 File "/usr/local/lib/python2.6/site-packages/django/core/handlers/
base.py", line 92, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/home/pikczur/app/root/glowna.py", line 35, in index
   o.save()

 File "/usr/local/lib/python2.6/site-packages/django/db/models/
base.py", line 410, in save
   self.save_base(force_insert=force_insert,
force_update=force_update)

 File "/usr/local/lib/python2.6/site-packages/django/db/models/
base.py", line 495, in save_base
   result = manager._insert(values, return_id=update_pk)

 File "/usr/local/lib/python2.6/site-packages/django/db/models/
manager.py", line 177, in _insert
   return insert_query(self.model, values, **kwargs)

 File "/usr/local/lib/python2.6/site-packages/django/db/models/
query.py", line 1087, in insert_query
   return query.execute_sql(return_id)

 File "/usr/local/lib/python2.6/site-packages/django/db/models/sql/
subqueries.py", line 324, in execute_sql
   return self.connection.ops.fetch_returned_insert_id(cursor)

 File "/usr/local/lib/python2.6/site-packages/django/db/backends/
__init__.py", line 171, in fetch_returned_insert_id
   return cursor.fetchone()[0]

ProgrammingError: no results to fetch

Latest Django trunk, Postgres 8.4.

Best regards,
Szymon
--~--~-~--~~~---~--~~
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: Opera File Upload Issue

2009-04-23 Thread Szymon

Hello,

I've faced same problem today. Have you find solution? Or anyone know
what can be wrong?

Best regards,
Szymon

On 30 Mar, 18:37, Peter <pco...@alum.mit.edu> wrote:
> I'm having an opera file upload issue, which may not be django's
> fault, but I'm curious if anyone has seen it (and has a solution)...
>
> When I upload an image *only in opera* (specifically 9.64 on mac osx)
> it doesn't appear in request.FILES.  However, if I upload a really
> small image 8kb, it works.  Same problem as this 
> post:http://groups.google.com/group/django-users/browse_thread/thread/eecc...
> (which no one has responded to)
>
> The only other thing that I could find on the internet that might
> refer to this was from this thread (in 
> 2001!):http://list.opera.com/pipermail/opera-users/2001-June/004854.html I'm
> currently running a very standard version of apache.
>
> If anyone else has encountered and solved this problem your input
> would be greatly appreciated!
>
> (also, yes the form has the proper enctype and the upload field is
> just rendered directly by the django form resulting in  type="file" name="image" id="id_image" />)
--~--~-~--~~~---~--~~
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 / Postrges problem

2009-03-26 Thread Szymon

I've added some syslog stuff to determine when cron job is done...
and, it's strange. It seems that cron job is done after 5 seconds, but
commits are done 3 minutes later.

Mar 26 10:10:01 ns204293 python: Job started
Mar 26 10:10:05 ns204293 python: Job done

And then

Mar 26 10:13:08 ns204293 postgres[10543]: [2-1] [10543]LOG:  duration:
2207.464 ms  statement: COMMIT
Mar 26 10:14:10 ns204293 postgres[10611]: [2-1] [10611]LOG:  duration:
1232.730 ms  statement: COMMIT
Mar 26 10:14:18 ns204293 postgres[10623]: [2-1] [10623]LOG:  duration:
2160.053 ms  statement: COMMIT
Mar 26 10:14:19 ns204293 postgres[10626]: [2-1] [10626]LOG:  duration:
1017.767 ms  statement: COMMIT
Mar 26 10:14:22 ns204293 postgres[10633]: [2-1] [10633]LOG:  duration:
1367.446 ms  statement: COMMIT
Mar 26 10:14:28 ns204293 postgres[10638]: [2-1] [10638]LOG:  duration:
1728.915 ms  statement: COMMIT
Mar 26 10:14:28 ns204293 postgres[10639]: [2-1] [10639]LOG:  duration:
1995.378 ms  statement: COMMIT
Mar 26 10:15:15 ns204293 postgres[10681]: [2-1] [10681]LOG:  duration:
2381.933 ms  statement: COMMIT

It's normal behaviour?
--~--~-~--~~~---~--~~
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 / Postrges problem

2009-03-26 Thread Szymon

On 26 Mar, 08:17, Szymon <szy...@mwg.pl> wrote:
> Mar 20 18:12:20 ns204293 postgres[27213]: [3-1] [27213]LOG:  process
> 27213 acquired ExclusiveLock on tuple (21,19) of relation 197227 of
> database 98304 after 42887.468 ms

Ah, and such entries too:

Mar 20 14:33:49 ns204293 postgres[7044]: [3-1] [7044]LOG:  process
7044 acquired ShareLock on transaction 85288146 after 27715.834 ms
--~--~-~--~~~---~--~~
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 / Postrges problem

2009-03-26 Thread Szymon

On 25 Mar, 21:15, Antoni Aloy  wrote:
> The obvious one: check your cron job .. Log your queries in postgres
> to see which querie consumes more time, it should be the cron job one.

I did it some time ago, and there are such entries:

Mar 20 18:12:20 ns204293 postgres[27213]: [3-1] [27213]LOG:  process
27213 acquired ExclusiveLock on tuple (21,19) of relation 197227 of
database 98304 after 42887.468 ms

Question is - should Django ever do a ExclusiveLock?

It's not resources problem, load average on cron job running is ~1,
then (when it's done), it goes to 4-5 because all pending ajax request
etc. are bashing Apache.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Django / Postrges problem

2009-03-25 Thread Szymon

Hello Django users,

I have big problem. For a few days my site isn't working properly. We
have two interfaces. First connected to Apache, second is cron job
running every 10 minutes (using Django ORM etc.). The problem is when
that job is running, there is some ExclusiveLock on postgres and web
interface have some lags, big lags. It's just like site stops working
for 1-2 minutes when there is cron job running. Any hints?

Best regards,
Szymon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



TransactionRollbackError?

2009-03-08 Thread Szymon

Hello,

For 2-3 days my application throws randomly (not always) such
exception:

Traceback (most recent call last):

 File "/usr/lib64/python2.5/site-packages/django/core/handlers/
base.py", line 86, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/home/www/django/czat/ajax.py", line 60, in xml
   d.delete()

 File "/usr/lib64/python2.5/site-packages/django/db/models/query.py",
line 433, in delete
   delete_objects(seen_objs)

 File "/usr/lib64/python2.5/site-packages/django/db/models/query.py",
line 982, in delete_objects
   del_query.delete_batch(pk_list)

 File "/usr/lib64/python2.5/site-packages/django/db/models/sql/
subqueries.py", line 88, in delete_batch
   self.do_query(self.model._meta.db_table, where)

 File "/usr/lib64/python2.5/site-packages/django/db/models/sql/
subqueries.py", line 35, in do_query
   self.execute_sql(None)

 File "/usr/lib64/python2.5/site-packages/django/db/models/sql/
query.py", line 1974, in execute_sql
   cursor.execute(sql, params)

TransactionRollbackError: deadlock detected
DETAIL:  Process 30291 waits for ExclusiveLock on tuple (0,96) of
relation 148468 of database 98304; blocked by process 30301.
Process 30301 waits for ShareLock on transaction 69891936; blocked by
process 30296.
Process 30296 waits for ExclusiveLock on tuple (0,105) of relation
148468 of database 98304; blocked by process 30332.
Process 30332 waits for ShareLock on transaction 69891934; blocked by
process 30291.

And it is always raised in the same place (d.delete()). What can cause
that problem?

DB is Postgres.

Best regards,
Szymon
--~--~-~--~~~---~--~~
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: CSS is not updated?

2009-01-12 Thread Szymon

On 12 Sty, 12:53, ltcstyle  wrote:
> But during my development, if I have updated my css file, the django-
> development web server is not responded properly. The old style is
> used. Then I have to use apache server to check if the CSS style is
> right for me.

I think it's not Django problem but web-server (for static files)
problem? Isn't it?

CTRL+F5 in web-browser - does it help?
--~--~-~--~~~---~--~~
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: Cannot resolve keyword 'user' into field. Choices are: id, job, name

2009-01-12 Thread Szymon

On 12 Sty, 15:40, John Baker  wrote:
> # later in code trying to delete
> candidate.delete()
>
> Any clues? (Django 1.0.2 final)

You need to provide how you fetch objects, I mean code before
cadidate.delete().
--~--~-~--~~~---~--~~
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: Migrating MySQL -> Postgre, any working solutions?

2009-01-05 Thread Szymon

On 4 Sty, 20:23, tofer...@gmail.com wrote:
> On 03.01-02:10, Szymon wrote:
> 3.      you will need to substitute quotation marks, mysql uses ""
> and postgresql uses \".  good old 'sed' to the rescue here.

This is not only difference - MySQL uses 0/1 for BooleanField,
Postgres t/f.

After two days of hard work, I've managed to migrate MySQL -> PgSQL.
That was hard. :)

Thanks for help.

Szymon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Migrating MySQL -> Postgre, any working solutions?

2009-01-03 Thread Szymon

Hello,

I've found in archives message:

> Check out django_extensions app, 
> http://code.google.com/p/django-command-extensions/.
> It has a command, dumpscript [...]

It takes ages to complete. I've tried that method yesterday. I've
turned off my web server and ran that command. After 6 hours it wasn't
completed. (~1 GB database)

So there is any other working solutions for migrating MySQL ->
Postgre?

Regards,
Szymon

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How to handle all DoesNotExist?

2008-06-14 Thread Szymon

Hello,

What I need to import to handle DoesNotExist in process_exception?
Because DoesNotExist is part of every single model, so I can't import
it from model, because I don't know which model raises exception.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: InnoDB problem

2008-05-14 Thread Szymon

Ok, nevermind. What a shame. That was just error in view. ;)

Greetings,
Szymon
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



InnoDB problem

2008-05-14 Thread Szymon

Hello,

I've chaged my database engine from MyISAM to InnoDB, then recreated
by syncdb schema, finally uploaded backed up data from older MyISAM
database. I've added today new model and get such error:

(1452, 'Cannot add or update a child row: a foreign key constraint
fails (`db/table`, CONSTRAINT `user_id_refs_id_1417f44f80439c` FOREIGN
KEY (`user_id`) REFERENCES `auth_user` (`id`))')

Any suggestions?

Best regards,
Szymon
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Data truncated for utf-8 string

2008-05-13 Thread Szymon

Hello,

I'm using MySQL as my backend. Everytime when I want save a utf-8
string there is warning that string has been truncated. Ie. I have
model with CharField(max_length=10), then want to add string
żźćźżąłśćó it throw warning.

What can I do to override that?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Caching get_profile

2008-05-11 Thread Szymon

Hello,

I know this is lame question, but - is there way to override somehow
get_profile? I want to implement memcache caching in there, so how can
I do it?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File caching and pickling issue

2008-05-02 Thread Szymon

On 30 Kwi, 16:12, Julien <[EMAIL PROTECTED]> wrote:
> [...]

http://groups.google.com/group/django-users/browse_thread/thread/ed3abed9122f5506/eb4237d8fe579e7b?lnk=gst=pickling+error#eb4237d8fe579e7b

So we have same problem? Have you find solution?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Pickling error / cmemcache?

2008-04-30 Thread Szymon

Hello,

Can anybody tell me what that exception means? It's my fault or some
kind of bug in Django (todays SVN, before upgrade there wasn't such
error).

Exception Type: PicklingError
Exception Value: Cant pickle class
django.utils.functional.__proxy__: attribute lookup
django.utils.functional.__proxy__ failed
Exception Location: /usr/lib64/python2.5/site-packages/cmemcache.py in
_convert, line 87
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: UnicodeDecodeError

2008-04-30 Thread Szymon

On 30 Kwi, 15:40, Amit Ramon <[EMAIL PROTECTED]> wrote:
> Hope this helps,

Yup. I've replaced that extra function with simple {{ foo.bar.0 }} in
templates and now everything works, so that was problem you've
described.

Thank you very much! :)

Szymon
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



UnicodeDecodeError

2008-04-30 Thread Szymon

Hello,

I have this code:

foo = bar.objects.filter(status=True).extra(select={ 'litera' :
'LEFT(CONCAT(pseudonim, nazwisko), 1)' })

and it gives me an error:

'utf8' codec can't decode byte 0xc5 in position 0: unexpected end of
data

when there is in database record starting with polish char "Ł".
Everything works ok, except that extra select. There is declared utf-8
coding in views.py.

Any suggestions?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---