Re: Custom attributes in Django

2010-08-31 Thread Sebastian Pawlus
Hi thanks for quick response.

I was thinking more about real custom attributes. Be able to define a
string, or choice filed from admin. And after all create query and/or
render form on it.
Application that we are working at requires different attributes on
objects from client to client.
We were looking for something like alex's
http://github.com/alex/django-taggit, but perfect situation will be a
tag with a type(or choice)

thanks

On Mon, Aug 30, 2010 at 6:20 PM, Beres Botond <boton...@gmail.com> wrote:
> Hi Sebastian,
>
> I suppose you are trying to do something like this?
>
> class CustomAttributes(models.Model):
>    name = models.CharField(max_length=30)
>    value = models.CharField(max_length=50)
>
> class ObjectWithCustom(models.Model):
>    name = models.CharField(max_length=30)
>    attributes = models.ManyToManyField(CustomAttributes)
>
> new_attr = o.attributes.create(name='custom_attr', value='value')
>
> ObjectWithCustom.objects.filter(attributes__value='value')
>
> For more info about many-to-many check out docs:
> http://www.djangoproject.com/documentation/models/many_to_many/
> Maybe describe in some detail what you are trying to accomplish (in
> terms of resulting functionality), as this might not necessarily be
> the best way to do it.
>
> Cheers,
>
> Béres Botond
>
> On Aug 30, 5:54 pm, Sebastian Pawlus <sebastian.paw...@gmail.com>
> wrote:
>> Hi
>>
>> Maybe im looking in wrong places or maybe there is no application to
>> cover functionality of carrying custom/admin defined attributes, or
>> maybe it isn't even possible.
>>
>> Use Case could looks like
>> Defining models
>>
>> from customr_attr import models
>>
>> class ObjectWithCustom(models.Model):
>>      name = models.CharField(max_length=30)
>>
>> o = ObjectWithCustom.objects.create(name='test')
>> o.custom_attr.create(name='custom_attr', value='value')
>>
>> >> o.custom_attr
>>
>> value
>>
>> >> ObjectWithCustom.objects.filter(custom_attr='value')
>>
>> [o]
>>
>> any ideas?
>
> --
> 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.
>
>

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



Custom attributes in Django

2010-08-30 Thread Sebastian Pawlus
Hi

Maybe im looking in wrong places or maybe there is no application to
cover functionality of carrying custom/admin defined attributes, or
maybe it isn't even possible.

Use Case could looks like
Defining models

from customr_attr import models

class ObjectWithCustom(models.Model):
 name = models.CharField(max_length=30)

o = ObjectWithCustom.objects.create(name='test')
o.custom_attr.create(name='custom_attr', value='value')

>> o.custom_attr
value

>> ObjectWithCustom.objects.filter(custom_attr='value')
[o]

any ideas?

-- 
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: Close window after download

2010-05-12 Thread Sebastian Pawlus
I'm not sure about your case
http://jquery.malsup.com/form/
and event "success",
take a look on http://jquery.malsup.com/form/#ajaxSubmit.


> Does anyone know how to track if a download completed?
>
> On May 6, 9:52 pm, CrabbyPete  wrote:
>> I have code that generates a file for download. I want to close the
>> window after the user selects the download or even redirect them.
>>
>> Here is my code:
>>
>> response = HttpResponse(cal.as_string(), mimetype='text/calendar')
>> response['Content-Disposition'] = 'attachment; filename=schedule.ics'
>> return response
>>
>> I can't close the window before the download using
>>
>> 
>>  
>> 
>>
>> because I get an error that the window closed.
>>
>> So after the form download the window is hanging in limbo. If anyone
>> knows
>> how to close the window I'd appreciate 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-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.
>
>

-- 
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: Multiple django version on developer machine

2010-05-12 Thread Sebastian Pawlus
And after virtualen take a look on virtualenvwrapper, makes virtualenv
more handy
http://pypi.python.org/pypi/virtualenvwrapper

On Wed, May 12, 2010 at 4:50 AM, Andy McKay  wrote:
>
> On 2010-05-11, at 7:26 PM, james_027 wrote:
>> While I have a number of django apps develop for Django 1.1 ... I also
>> want to use Django 1.2 for my new project. How can I have multiple
>> version of Django in my machine where my apps will be instructed
>> either to use 1.1 or 1.2
>
> You should look at using virtualenv to isolate your environment:
>
> http://pypi.python.org/pypi/virtualenv
> --
>  Andy McKay, @andymckay
>  Django Consulting, Training and Support
>
> --
> 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.
>
>

-- 
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: Django 1.1 features covered in book.

2010-01-30 Thread Sebastian Pawlus
Thanks Shawn for a book, and ekm Bill for link cool website cool colors ;)
one for you http://tinyurl.com/ydud8rl

On Fri, Jan 29, 2010 at 6:07 PM, Shawn Milochik  wrote:

> "The Definitive Guide to Django," Second Edition by Adrian Holovaty and
> Jacob Kaplan-Moss covers Django 1.1.
>
> I have a copy sitting on my desk right now.
>
> Shawn
>
> --
> 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.
>
>

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



Django 1.1 features covered in book.

2010-01-29 Thread Sebastian Pawlus
Hi

Do you know any Django books which cover functionalities introduced by
version 1.1?

thanks

-- 
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: Database performance during test execution

2010-01-29 Thread Sebastian Pawlus
Thanks Russell, your answer was more than helpful. It really worked for me.
There were some problems on Django 1.0 but after that (1.1 and up) every
thing looks good. Performance of database looks much better right now.

I'm also wandering if that issue is well enough explained in Django docs?

On Fri, Jan 29, 2010 at 12:15 PM, Russell Keith-Magee <
freakboy3...@gmail.com> wrote:

> On Fri, Jan 29, 2010 at 6:51 PM, Sebastian Pawlus
> <sebastian.paw...@gmail.com> wrote:
> > Hi everyone
> > I've very confusing issue related whit databases performance. I've took
> two
> > database engines and compared their performance during typical run for
> > project test suite.
> > results:
> > MySQL: Ran 241 tests in 533.822s
> > PostgreSQL: Ran 241 tests in 34.468s
> > Results are more than strange. I don't even start to think that MySQL is
> 9
> > times slower, but what is going on?
>
> It depends on your MySQL configuration. If you're using MyISAM tables,
> this is probably the cause of the slowdown you are seeing.
>
> To ensure that a clean test environment is available at the start of
> every test, Django clears out the database before each test starts. To
> make this a fast process, Django uses transactions where possible -
> rather than deleting and reloading test data, Django will commence a
> transaction at the start of the test, and roll back to the start of a
> transaction at the end of the test. There are some exceptions where
> this speedup isn't possible - most notably, if you're actually testing
> transactional behaviour - but this optimization is used by a lot of
> Django's test suite.
>
> Postgres makes full use of this transaction support, and as a result,
> tests are quite fast. However, not every MySQL configuration supports
> transactions. If your MySQL database doesn't support transactions (and
> MyISAM generally falls into this category), tests will run a *lot*
> slower. 10x slower would not be at all surprising.
>
> This doesn't mean that MySQL/MyISAM will be slow in general - just
> that the test suite will be slow. The test suite is doing something
> pathological: loading and deleting hundreds of data, over and over
> again. This isn't something most actual running applications will ever
> need to do, so it isn't a cause for concern for production.
>
> Unfortunately, there isn't much we can do about it. Without access to
> transactions, there isn't any way to speed up test cases.
>
> Yours,
> Russ Magee %-)
>
> --
> 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<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://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.



Database performance during test execution

2010-01-29 Thread Sebastian Pawlus
Hi everyone

I've very confusing issue related whit databases performance. I've took two
database engines and compared their performance during typical run for
project test suite.

results:
MySQL: Ran 241 tests in *533.822s*
PostgreSQL: Ran 241 tests in *34.468s*
*
*
Results are more than strange. I don't even start to think that MySQL is 9
times slower, but what is going on?

Databases are from ubuntu packages:

Mysql:
mysql> select version();
+-+
| 5.1.37-1ubuntu5 |
+-+

Postgres:
user=# select version();
  version

---
 PostgreSQL 8.4.2 on i486-pc-linux-gnu, compiled by GCC gcc-4.4.real (Ubuntu
4.4.1-4ubuntu8) 4.4.1, 32-bit
(1 row)


Any ideas where I've made a mistake?

x_O

-- 
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: Top 10 tips to a new Django developer. correct approach?

2010-01-15 Thread Sebastian Pawlus
I see but i thing there is more than my personal preference.

http://docs.djangoproject.com/en/dev/howto/deployment/modpython/



SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonOption django.root /mysite
PythonDebug On
*PythonPath "['/path/to/project'] + sys.path"*


If I'm using project path, this bottom is going to produce errors. I'm
really curious about that '/path/to/project' is that project is project
where the settings.py file is, or is this only wrapper for
/path/to/project/mysite/settings.py. (where the mysite is really a project
in django meaning)

It's a bit unclear for me.


On Fri, Jan 15, 2010 at 12:34 PM, Dougal Matthews <douga...@gmail.com>wrote:

> If you want your app to be shipped individually and re-used then you
> shouldn't use the project name. If you make a reusable app and release it
> then I want to use it, I don't want to have to include the project
> namespace, i just want the app.
>
> However, its your shipping the project as a whole then it doesn't really
> matter and its then its just down to personal preference really.
>
> Dougal
>
> 2010/1/15 Sebastian Pawlus <sebastian.paw...@gmail.com>
>
>> Hi
>>
>> I've found something like "Top 10 tips to a new Django developer"
>>
>> http://blog.dpeepul.com/2009/08/31/top-10-tips-to-a-new-django-developer/
>>
>> I'm really blasted by first point "Don’t put project name  in the
>> imports". is this point correct? Django site and core developers
>> http://github.com/jacobian/cheeserater/blob/master/urls.py
>> http://code.djangoproject.com/browser/djangoproject.com/django_website/
>>
>> break that rule.
>>
>> x_O
>>
>> --
>> 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<django-users%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://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<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://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.



Top 10 tips to a new Django developer. correct approach?

2010-01-15 Thread Sebastian Pawlus
Hi

I've found something like "Top 10 tips to a new Django developer"

http://blog.dpeepul.com/2009/08/31/top-10-tips-to-a-new-django-developer/

I'm really blasted by first point "Don’t put project name  in the imports".
is this point correct? Django site and core developers
http://github.com/jacobian/cheeserater/blob/master/urls.py
http://code.djangoproject.com/browser/djangoproject.com/django_website/

break that rule.

x_O
-- 

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.