Predefined models like tree,sortable_set

2009-07-13 Thread Maksymus007

I recently switched to Django from PHP with Doctrine ORM - there was a
possibility to make model 'act as' for example NestedSet - which
automagically added required fields and methods to operate on Tree -
adding, moving,deleting nodes etc. Is this somehow possible in Django?

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



Dynamic routing

2009-07-13 Thread Maksymus007

Its possible to use dynamic (database based maybe) routing, instead of
static one?

--~--~-~--~~~---~--~~
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 admin for PHP?

2009-07-14 Thread Maksymus007

On Tue, Jul 14, 2009 at 10:00 AM, Bela Hausmann wrote:
>
> Hi everybody!
>
> I use django a lot, and I'm really glad about the admin interface. I
> always hated to code admin interfaces myself, never again :)
>
> But now I have the task of making a new corporate website with a PHP
> framework, and my question is, are there any frameworks, that have a
> django-like (= powerfull, automatic, model based, easy) admin
> interface/generater.
>
> I know about the symfony admin generator (which is not as easy as the
> django admin). Are there any more?
>
> I know this is kind of off-topic, but only django users know how
> powerful the django admin is, so I can't ask the PHP community.
>
> Best regards from Austria,
> Bela

Symphony, CakePHP

--~--~-~--~~~---~--~~
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: Non html safe chars on urls,

2009-08-03 Thread Maksymus007

On Mon, Aug 3, 2009 at 11:27 AM, Mirat Bayrak wrote:
> Hi i have an account system that you have to validate your email after you
> created an account. My validation url is lik :
> www.foo.com/account/confirm/username/keyyy
>
> But there is a problem, sometimes username contains non html safe chars for
> example : âlice, or süleyman cant go that adress...
>
> So, what should i do? should i restrict usuable characters on usernames or
> is there another solution?
>

Use user_id instead of username? Encode username with base64? URLs can
contain UTF8 characters if properly encoded, so i dont think this is a
problem.

--~--~-~--~~~---~--~~
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: Select Table or Database based on User

2009-08-05 Thread Maksymus007

>
> Hi everyone,
>
> I'm sure this has come up in the past, but I sincerely can't find it
> in any of the Django tutorials, documentation, or websites. I
> apologize in advance if I missed something!
>
> I'm trying to develop a website where different users store their own
> sets of contacts / articles / etc. If a user logs in, I only want them
> to have access to their own articles or contacts. As such, I'm
> thinking that storing each individual user's data in their own table
> is the way to go.
>
> However, my question is: how do I actually have Django select the
> proper table? The models and views stay the same, but I need to make
> sure that, given a user name, Django selects the proper table(s).
>
> Is there a tutorial on this? A link? Any advice would be appreciated.
>
> Thanks,
> Wojciech

and why not to just store user_id column for each table?
Tylko jak to django adminowi powiedzieć...

--~--~-~--~~~---~--~~
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: Multiple instances of the same form on one page: how to get the right POST data?

2009-08-05 Thread Maksymus007

On Wed, Aug 5, 2009 at 11:16 PM, Berco Beute wrote:
>
>> You forgot to set the prefix here, so the form that the user is
>> submitting their data from doesn't have the fields named correctly. You
>> need to set it up exactly the same way at this point as you did in the
>> POST path, with the exception of not prepopulating with data.
>
> Thanks, the missing prefix was indeed one issue, although
> prepopulating with data is not a problem. It didn't solve the problem
> though. The problem arises from the fact that I'm rendering multiple
> forms, but the user is POSTing back only one form. Each form has it's
> own submit field. How do I know which form was submitted? I've tried
> stripping the prefix from the subitted form, but that felt kind of
> hacky (and didn't really work).
>

how about hidden input?

--~--~-~--~~~---~--~~
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: Select Table or Database based on User

2009-08-05 Thread Maksymus007

On Thu, Aug 6, 2009 at 12:38 AM, Wojciech Gryc wrote:
>
> Thanks for your replies!
>
> The problem with storing the user ID for each table and then filtering
> by the ID is that once the data set grows very large, this will become
> extremely slow (as far as I understand).
>
> I expected to have about 2000 pieces of information per user, with
> several dozen users (at least). Filtering by user ID each time would
> be extremely wasteful, would it not?

I think it really depends on database - however such a simple
operation like filtering based on indexed field shouldn't take much
resources .
How about database views?
Several dozens of users means several dozens * number of content types tables...

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

2009-08-15 Thread Maksymus007

On Sat, Aug 15, 2009 at 6:34 PM, Thiago511 wrote:
>
> Well Sam, I am making some progress. at least I got a different error
> message(I am actually excited lol)
> here:
>
> python: can't open file 'django-admin.py': [Errno 2] No such file or
> directory
>
> On Aug 15, 9:25 am, Sam Lai  wrote:
>> From the tutorial:
>>
>> "django-admin.py should be on your system path if you installed Django
>> via python setup.py."
>>
>> This might be different for Windows - it might not be on the system path. 
>> Try:
>>
>> python django-admin.py startproject mysite
>>
>> If that doesn't work, use the full path to your python executable.
>>
>> To make things easier later, add the directory containing the python
>> executable to your system path (Control Panel -> System -> Advanced ->
>> Environment Variables -> PATH).
>>
>> 2009/8/16 Thiago511 :
>>
>>
>>
>> > python and Django are both installed already
>>
>> > On Aug 15, 9:11 am, Sam Lai  wrote:
>> >> You need to install python then django first before trying the
>> >> tutorial - start herehttp://docs.djangoproject.com/en/dev/intro/install/
>>
>> >> 2009/8/16 Thiago511 :
>>
>> >> > I went to that link you gave me. I tried it, and I go the same error
>> >> > message.
>>
>> >> > they told me to:
>>
>> >> > "From the command line, cd into a directory where you’d like to store
>> >> > your code, then run the command django-admin.py startproject mysite. "
>>
>> >> > I  cd into the folder I have set up but when I type: django-admin.py
>> >> > startproject mysite
>> >> > I get this:
>>
>> >> > "django-admin.py" not recognized as an internal or external command,
>> >> > operable program or batch file.
>>

dont get this as a spam, but i wrote on my blog last night -
blog.maksymus007.info :)

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

2009-08-15 Thread Maksymus007

On Sat, Aug 15, 2009 at 7:08 PM, Thiago511 wrote:
>
> hey mark, I am following your tutorial, and I am stuck in:
>
> step 3
> Right list contains Open? If yes, select it and Edit, if not Add. Set
> accoring to screenshot below, remeber about python.exe path - may be
> different.
>
> What screenshot below?
>

fixed now.

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

2009-08-15 Thread Maksymus007

On Sat, Aug 15, 2009 at 7:18 PM, Thiago511 wrote:
>
> python is in %PATH%
> Django is not though.
> How do I add it to %PATH% ?
>
>

if you installed django by python setup.py install than it is in
site-packages directory of Python instalation and having Python in
%PATH% everything should work - python will find django itself

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

2009-08-15 Thread Maksymus007

copy django-admin.py into C:\Python26\Scripts and add this into %PATH% :)
Or add c;\Python26\Lib\site-packages\bin\django-admin to %PATH% but
I'd preffer first one

On Sat, Aug 15, 2009 at 7:31 PM, Thiago511 wrote:
>
> oh ok mark, yeah I can see django in site-packages
> and I see django-admin in the bin folder:
> c;\Python26\Lib\site-packages\bin\django-admin
>
> So why doesn't it open in cmd?
>
> On Aug 15, 10:22 am, Maksymus007  wrote:
>> On Sat, Aug 15, 2009 at 7:18 PM, Thiago511 wrote:
>>
>> > python is in %PATH%
>> > Django is not though.
>> > How do I add it to %PATH% ?
>>
>> if you installed django by python setup.py install than it is in
>> site-packages directory of Python instalation and having Python in
>> %PATH% everything should work - python will find django itself
> >
>

--~--~-~--~~~---~--~~
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: How to get DATABASE_NAME

2009-08-16 Thread Maksymus007

import myproject.settings;

if settings.DATABASE_NAME = x:


On Sun, Aug 16, 2009 at 10:30 AM,
adelaide_mike wrote:
>
> In my reporting function I need to have:
>
> If DATABASE_NAME = x:
>    #do this
> Else:
>    #do the other
>
> How can I obtain that name, which is established in settings.py?
>
> Mike
> >
>

--~--~-~--~~~---~--~~
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: new session ID is created for every request from IE 7

2009-08-19 Thread Maksymus007

On Thu, Aug 13, 2009 at 4:21 AM, humble wrote:
>
> Hi,
>
> I am writing a web application that involves session management with
> the corporate backend module. I wrote my own authentication backend
> plugin to satisfy the corporate requirement, not the default
> authentication backend. I use file based session engine to avoid
> sqlite crap. Everything works fine in firefox and chrome. But it seems
> to be a problem with IE: response includes a new session ID (actually
> a test cookie) for each request from IE. It seems IE never sends back
> the previous cookie given by the server in subsequent request. Check
> in /tmp/ (where I store all session files), I see the previous session
> file is replaced with a new empty session file.
>
> Looking in to contrib.session.middleware.py confirms
> "request.session.session_key" is different for each request. However,
> this only happens when I use IE.  I configured IE 7 to allow cookies,
> so it does not reject cookies from django. What might be the problem?
> Has any one seen this issue before?

IE requires your domain to have at least 2 parts - so you cannot set,
for example, cookie.domain like .application even such a domain is
valid in your network.

--~--~-~--~~~---~--~~
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: JSON Serialization with ImageField

2009-08-24 Thread Maksymus007

On Tue, Aug 4, 2009 at 10:58 PM, scuzz wrote:
>
> Hi,
>
> I'm trying to receive a file encoded in a json string and store it in
> an ImageField. I was hoping to use the standard Django deserialisation
> like:
>
> serializers.deserialize("json", "...snip..., \"myImageField\":
> \"base64encodedimage\", ...snip...)
>
> however it tries to store the image content string directly in the
> field rather than going through the imagefield file storage mechanism.
> has anyone solved this?
>
> i've got control of the creation of the json string, so i can encode
> the image however works best. i wasn't expecting base64 strings to
> just work but that's a separate though related problem. i'm guessing i
> need a hook into the deserialization to handle images specially but i
> don't see how to go about it.
>
> thanks for any help
>

I may be wrong, but ImageField handles file upload via POST by
utilizing request.FILES - which is an array containing information
about file and generator for reading data - why you try to put there
raw data ?

--~--~-~--~~~---~--~~
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 check which form was submitted?

2009-08-27 Thread Maksymus007

I've got two different form on the same page, under the same URL.
When I send one of them, the second one gets validated too.
I set prefixes but no change.

Is there any way to distinguish between two forms, choosing one that
have been submited?

--~--~-~--~~~---~--~~
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: How to check which form was submitted?

2009-08-27 Thread Maksymus007

On Thu, Aug 27, 2009 at 1:22 PM, David Zhou wrote:
>
> On Thu, Aug 27, 2009 at 7:09 AM, Maksymus007 wrote:
>>
>> I've got two different form on the same page, under the same URL.
>> When I send one of them, the second one gets validated too.
>> I set prefixes but no change.
>>
>> Is there any way to distinguish between two forms, choosing one that
>> have been submited?
>
> Prefixes are for using the same form multiple times on a page,
> avoiding name collisions.
>
> Post the part of your view that handles your forms.
>
> -- dz
>

Nothing special

if request.method == 'POST':
form = RegisterForm(request.POST)
if form.is_valid():
 pass

And second one is handled by middleware, in similar way

--~--~-~--~~~---~--~~
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: How to check which form was submitted?

2009-08-27 Thread Maksymus007

On Thu, Aug 27, 2009 at 1:41 PM, David Zhou wrote:
>
> On Thu, Aug 27, 2009 at 7:33 AM, Maksymus007 wrote:
>>
>> On Thu, Aug 27, 2009 at 1:22 PM, David Zhou wrote:
>>> Post the part of your view that handles your forms.
>>
>> Nothing special
>>
>>    if request.method == 'POST':
>>        form = RegisterForm(request.POST)
>>        if form.is_valid():
>>             pass
>>
>> And second one is handled by middleware, in similar way
>
> Put in a hidden inputs in your fields to distinguish the two.  For example:
>
> if request.method == 'POST' and '_hiddenname' in request.POST:
>     ...
>
> -- dz
>

Thats what I did :)
Sad there is no special option to add to form or was_post(), but thanks anyway;

--~--~-~--~~~---~--~~
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: How to check which form was submitted?

2009-08-27 Thread Maksymus007

On Thu, Aug 27, 2009 at 5:00 PM, Thomas Guettler wrote:
>
>
>
> Maksymus007 schrieb:
>> On Thu, Aug 27, 2009 at 1:22 PM, David Zhou wrote:
>>> On Thu, Aug 27, 2009 at 7:09 AM, Maksymus007 wrote:
>>>> I've got two different form on the same page, under the same URL.
>>>> When I send one of them, the second one gets validated too.
>>>> I set prefixes but no change.
>>>>
>>>> Is there any way to distinguish between two forms, choosing one that
>>>> have been submited?
>>> Prefixes are for using the same form multiple times on a page,
>>> avoiding name collisions.
>>>
>>> Post the part of your view that handles your forms.
>>>
>>> -- dz
>>>
>>
>> Nothing special
>>
>>     if request.method == 'POST':
>>         form = RegisterForm(request.POST)
>>         if form.is_valid():
>>              pass
>>
>> And second one is handled by middleware, in similar way
>
> You handle forms in a middleware? Why? Middleware code gets
> executed for every http request ...
>
>  Thomas
>

Yes I know, but thats happen only if user has no session and all pages
are restricted to logged users.

--~--~-~--~~~---~--~~
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: SOAPLIB issue with django upgrade

2009-08-29 Thread Maksymus007

On Sat, Aug 29, 2009 at 5:40 AM, Wombatpm wrote:
>
> For the record.  SOAPLIB 0.8.1 has a bug in generating the WSDL file
> for Arrays.
>
>> 
>> -
>> 
>> > name="string"/>
>> 
>> 
>
> the type declaration should be type="xs:string"
>
>
> The unicode issue is being raised by lxml inside of soaplib.  Calls
> from .NET clients include an xml declaration and an encoding type.
> Calls from SOAPUI do not include the xml declaration.  Under python
> 2.6 strings are unicode so lxml raises the error.
>
> Question to django world:  Where is the best place to fix this bug?
> lxml where they punted on unicode strings effectively?  Soaplib which
> should sanitize its calls?  or Django since it knows what it received
> over the intertubes and is in the best position to create the string
> correctly?
>
> WombatPM
>

I was debugging till 3am yesterday to fix this, but not everything works now.
I fixed this unicode bug (but didn't test this with real unicode chars)
Generating arrays is another strange thing, 'cause my simple service
does not use it.
Hope today or tomorrow I fix it and then will post patch here and to
soaplib developers

--~--~-~--~~~---~--~~
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: SOAPLIB issue with django upgrade

2009-08-29 Thread Maksymus007

On Sat, Aug 29, 2009 at 10:33 AM, Maksymus007 wrote:
> On Sat, Aug 29, 2009 at 5:40 AM, Wombatpm wrote:
>>
>> For the record.  SOAPLIB 0.8.1 has a bug in generating the WSDL file
>> for Arrays.
>>
>>> 
>>> -
>>> 
>>> >> name="string"/>
>>> 
>>> 
>>
>> the type declaration should be type="xs:string"
>>
>>
>> The unicode issue is being raised by lxml inside of soaplib.  Calls
>> from .NET clients include an xml declaration and an encoding type.
>> Calls from SOAPUI do not include the xml declaration.  Under python
>> 2.6 strings are unicode so lxml raises the error.
>>
>> Question to django world:  Where is the best place to fix this bug?
>> lxml where they punted on unicode strings effectively?  Soaplib which
>> should sanitize its calls?  or Django since it knows what it received
>> over the intertubes and is in the best position to create the string
>> correctly?
>>
>> WombatPM
>>
>
> I was debugging till 3am yesterday to fix this, but not everything works now.
> I fixed this unicode bug (but didn't test this with real unicode chars)
> Generating arrays is another strange thing, 'cause my simple service
> does not use it.
> Hope today or tomorrow I fix it and then will post patch here and to
> soaplib developers
>

OK, so mi fixes are simple.
Open serializers/primitive.py

and change line 445 to

"%s:%s" % (self.serializer.get_namespace_id(), self.serializer.get_datatype()))

and

soaplib/soap.py line 118 to

root, xmlids = ElementTree.XMLID(xml_string.encode())

and this makes by services and WSDL files working both in SoapUI and
standard PHP SOAP without any problems (remember to name parameters in
PHP :) )

--~--~-~--~~~---~--~~
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: signals (post_save, pre_save) vs save()

2009-08-31 Thread Maksymus007

On Mon, Aug 31, 2009 at 10:49 PM, eka wrote:
>
> Hi all.
>
> I have this question on when one is preffered over another. I mean
> overriding save or using signals like post_save or pre_save.
>
> cheers.
>

The scale. signals are used for every model, save() per one

--~--~-~--~~~---~--~~
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 Module named ... problem

2009-09-03 Thread Maksymus007

On Thu, Sep 3, 2009 at 12:13 PM, phoebebright wrote:
>
> Russ,
>
> Phew - you set me on the right track there.  I actually had an app
> called events at the same level as the main app
>
> /django
>   /appwithproblem
>       /web
>       /events
>   /events
>      /web
>
>
> There are various errors reported - like the above .__init__ one where
> python behaves correctly but not in the way some newbies might
> expect.  Be great to write an app that looked for all these possible
> errors  - called "dont_do_that" maybe.  If I had a spare 5 mins
>
>
> Thanks so much.
>

Did you checked module's directory permissions? I had similar problem
and simply solved by proper chmod

--~--~-~--~~~---~--~~
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: how to deploy an app that gets used by people in multiple time zones

2009-09-04 Thread Maksymus007

On Thu, Sep 3, 2009 at 11:36 PM, Margie
Roginski wrote:
>
> I've created a django app and I soon am going to have users that are
> in multiple timezones.  My app is a task management system and it is
> important for users to see dates and times with respect to their own
> time zone.  IE, if here in California I create a task at 3PM on Sept
> 3, I want someone in India to see it as being created at 1AM on Sept
> 4.  Optimally, if that India employee travels to the US and looks at
> the task creation date, they should see 3PM on Sept 3.   Is there a
> "best" way to handle this?  Things that come to mind are:
>
>  1. Create a deployment for each of my time zones where TIME_ZONE and
> DATE_FORMAT are set appropriately for the time zone associated with
> the deployment.  This seems painful ...
>
>  2. Have a single deployment and whenever I display dates, use some
> sort of tag that can figure out how to display the date correctly
> based on the user's time zone
>
>  3. I see there is a reusable app called django-timezones.  There is
> not much doc with it, but I'm guessing this is targeted at what I am
> trying to do.
>
> Can anyone give any recommendations?  I'm happy to dive in and read
> source (ie, for django-timezones app), but I just want to make sure
> I'm heading in the right direction.
>
> Thanks,

have you tried to use postgres timestamp with time zone field? It has
ability to make such a conversion on the fly and every date can be
stored with timezone

--~--~-~--~~~---~--~~
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: Is it possible to integrate php with django?

2009-09-07 Thread Maksymus007

On Mon, Sep 7, 2009 at 11:08 AM, kk wrote:
>
> I want to implement a php e-shop module called "Ecshop" which is
> written in PHP with my django website.
> Is it possible?

sure it is. You can configure apache to handle some files like PHP
scripts, and there you can do whatever you want - connect to common
database and read orders made by django.

--~--~-~--~~~---~--~~
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: Save model as new record in db

2009-09-07 Thread Maksymus007

save(force_insert=True) ?

On Mon, Sep 7, 2009 at 11:11 AM, lzantal wrote:
>
> Hi,
>
> I need to save_as in the model of my app So I can save existing
> records as new ones.
> I know there is an option in modeladmin but I don't have an admin
> interface for this app.
> Tryed calling force_insert on the save method with no success.
>
> Any help would be greatly appreciated
>
> thank you
>
> lzantal
>
> >
>

--~--~-~--~~~---~--~~
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 settings function object?

2009-09-08 Thread Maksymus007

I tried following code

from django.conf import settings

...


a = setting.MY_OWN_VARIABLE=2

I get error

'function' object has no attribute 'MY_OWN_VARIABLE'

when I

print settings

it says its function object - instead of LazySettings object. I tried even

from django.conf import settings as something_that_cannot_make_collision

but result is the same.

Any idea why and how to fix?

--~--~-~--~~~---~--~~
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 settings function object?

2009-09-08 Thread Maksymus007

On Tue, Sep 8, 2009 at 5:55 PM, Masklinn wrote:
>
> On 8 Sep 2009, at 14:00 , Maksymus007 wrote:
> I tried following code
>>
>> from django.conf import settings
>>
>> ...
>>
>>
>> a = setting.MY_OWN_VARIABLE=2
> You probably shouldn't set settings variables at runtime. And by
> "probably" I mean "really". Use getattr instead if you need "default
> value in case the setting isn't defined".
>

heh, that was just a copypasta from source.
Real problem was simple - i had a view named settings(request) which
made a collision.

--~--~-~--~~~---~--~~
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: How to server static media secured by Django authentication

2009-09-11 Thread Maksymus007

On Fri, Sep 11, 2009 at 11:03 PM, Jim Myers  wrote:
>
> I have a requirement to serve static files only to users authenticated
> through Django secure login.
> That means I can't use apache basic/digest authentication for those
> files.
>
> So far in my searches of the web and Django docs, I've found no way to
> do this.
> Of course my alternative is to serve ALL the static files through
> Django but that's not very palatable.
>

Its the only way to do this, as long as django auth is required.
You can write your own static file serving function and add caching
(memcache?) to it.

But you can try to, for example, make directories named like session
cookie hash and force user to get all static content there, serving
thgouh 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
-~--~~~~--~~--~--~---



Re: Make a bold row in a table

2009-09-12 Thread Maksymus007
On Sat, Sep 12, 2009 at 4:12 PM, adelaide_mike
 wrote:
>
> Django 1.0.2   In the following template I intend to make rows that
> have an empty second column bold.  Hence trying 2 in row.  My syntax
> is wrong due to inexperience with Python, and possibly my methodology
> also.
>
> {% extends "base.html" %}
> {% block content %}
>
> 
> Agent summary report
>  The most recent listing for each property listed within the past
> 12 weeks
> 
>
>       
>           
>               Address
>               Date
>               Price
>               Method
>               Agent
>                 
>               Mobile
>       
>       
>           {% for row in listings %}
>                             endifequal %}
>>
>                            {% for item in row %}
>                        {{ item }}
>                    {% endfor %}
>                        
>
>           {% endfor %}
>        
>                
> 
>
> 
>
> {% endblock %}
>
> Is there a way to do this?
>
> Mike

add method to your model like should_be_bold which return boolean and
use it in template like
{% if row.should_be_bold %}class="bold"{%endif %}

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



Syntax error

2009-09-15 Thread Maksymus007

Whats wrong with such template (entire one):? Django returns

TemplateSyntaxError at /scratchcards/

Invalid block tag: 'else'

pointing at tag marked by >>

{% if gates.forms %}

    {% for form in gates.forms %}

        {% if forloop.first %}

        {% else %}

        {% endif %}


    {% endfor $}


>> {% else %}

{% endif %}

--~--~-~--~~~---~--~~
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: Syntax error

2009-09-15 Thread Maksymus007

On Tue, Sep 15, 2009 at 1:28 PM, Gonzalo Delgado
 wrote:
> El Tue, 15 Sep 2009 12:49:02 +0200
> Maksymus007  escribió:
>
>> {% if gates.forms %}
>>
>>     {% for form in gates.forms %}
>>
>>         {% if forloop.first %}
>>
>>         {% else %}
>>
>>         {% endif %}
>>
>>
>>     {% endfor $} <<<<<<<<<<<<<<<<<<<<<<<<<<<<< ?
>>
>>
>> >> {% else %}
>>
>> {% endif %}
>
>
> --
> P.U. Gonzalo Delgado 
> http://gonzalodelgado.com.ar/
>

Silly me :D 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-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
-~--~~~~--~~--~--~---



Inheritance from real model (or models with the same fields but different table)

2009-09-16 Thread Maksymus007

I need to have 4 versions of exactly the same model - but named
differently and using different table/views (some complex filtering is
required and database permission stuff)

I simply did:

class Event(models.Model):
a = models.IntegerField()
class Meta:
db_table = 'event'

and then

class EventCurrent(Event):
class Meta:
db_table = 'event_current'

But using EventCurrent performs INNER JOIN with base 'event' table
using unknown column event_id_ptr (which wasnt declared) - number of
fields is bigger (c.a. 80) and containt primaryKey. Whats the best
solution to do such a thing? Inheriteds models are not going to
insert/update since they are working on views.

--~--~-~--~~~---~--~~
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 ommit non-set field on insert

2009-09-16 Thread Maksymus007

Is there any way to make Django ORM NOT assign every possible column a
value? I just want it to insert values i defined or have set
default=Something, but don't touch other s columns leaving database
default?

Currently django fills ununsed fields with NULL, but i just want it ommit them.

--~--~-~--~~~---~--~~
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: benefits of {% url %} for breadcrumbs?

2009-09-16 Thread Maksymus007

On Wed, Sep 16, 2009 at 10:53 PM, neri...@gmail.com  wrote:
>
> Is there any benefit to using {% url %} other than retrieving data
> from the same view? I was looking for a better way to make a
> breadcrumb menu than hard wiring the urls into every page and came
> across the {% url %} tag and this post:
>
> http://groups.google.com/group/django-users/browse_thread/thread/b42d814e8f52b89a/45cf75b352c709b0?lnk=gst&q=breadcrumb#45cf75b352c709b0
>
> It makes sense to me to use {% url %} in order to retrieve data form
> the same view but if you have to pass {% url %} a specific view then
> what's the difference than hard wiring a url?
>
> Thanks,
>
> Jason
>
 DRY principle?

--~--~-~--~~~---~--~~
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 Null values display

2009-09-17 Thread Maksymus007

I've got some models which has fields. Those fields can contain Null.
There are also some FK, which are not obligatory - they can be null as
well.
When it comes to display list of objects, in places of Null i get
'None' string - no matter if use i18n or not. For fields with FK i get
'(None)'
This, however, can be simply fixed by using models function for this -
but not when it comes to use list_filter in AdminModel class.
Is there any way to customize this behaviour and place other, defined string?

--~--~-~--~~~---~--~~
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: equivalent of getattr in a django template

2009-09-23 Thread Maksymus007

On Wed, Sep 23, 2009 at 7:05 PM, Chris Withers  wrote:
>
> Hi All,
>
> I have this view function:
>
> def index(request,model,pk=None):
>
>     return list_detail.object_list(
>         request,
>         queryset=model.objects.all(),
>         paginate_by=10,
>         template_name='index.html',
>         extra_context=dict(
>             column_titles = [f.name for f in model._meta.fields],
>             )
>         )
>
> Where index.html is:
>
> 
>   
>   {% for title in column_titles %}
>     {{title}}
>   {% endfor %}
>   
>   {% for object in object_list %}
>   
>     {% for name in column_titles %}
>     
>     {{*what goes here*}}
>     
>     {% endfor %}
>   
>   {% endfor %}
> 
>
> What do I put in the marked spot to be the equivalent of
> getattr(object,name)?
>
> cheers,
>
> Chris
>
> --
{{object.name}} ?

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



Menu managements, current URL

2009-09-29 Thread Maksymus007

I'm looking for simple way of managing menu - so my question is - how
i can get currently used URL?

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



select_related() and Additional keywords

2009-10-02 Thread Maksymus007

I used query in form

a = X.objects.select_related('gate__keywords_set').filter(field=value)

and then tried to get elements from related
a[x].gate.keywords_set - there is a RelatedManager object which forces
me to call all() method to get elements. And problem is that this
causes additional queries - one for each gate. Why this data isnt
hydrated and available at runtime without additional queries?

--~--~-~--~~~---~--~~
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: select_related() and Additional keywords

2009-10-02 Thread Maksymus007

On Fri, Oct 2, 2009 at 12:58 PM, Daniel Roseman  wrote:
>
> On Oct 2, 11:45 am, Maksymus007  wrote:
>> I used query in form
>>
>> a = X.objects.select_related('gate__keywords_set').filter(field=value)
>>
>> and then tried to get elements from related
>> a[x].gate.keywords_set - there is a RelatedManager object which forces
>> me to call all() method to get elements. And problem is that this
>> causes additional queries - one for each gate. Why this data isnt
>> hydrated and available at runtime without additional queries?
>
> It seems like the relationship between gate and keywords is a reverse
> one - that is, the foreign key is from keyword to gate, not the other
> way round. select_related() doesn't work on reverse relationships.
> --

yes it is. But this generate no error and works when using
gate.keywords_set.all()
Adding many to many to gates should solve problem?

--~--~-~--~~~---~--~~
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: Help debug strange errors

2009-10-02 Thread Maksymus007

On Fri, Oct 2, 2009 at 1:46 PM, gustavo  wrote:
>
> Hello fellows,
>
> I have been developing a little blog app as described in
> http://www.aprendendodjango.com, what means Learning Django. It this
> very interesting.
>
> But I've got problems when I tryed to deploy. It seems everything is
> ok, but the log server is telling me that it is searching for a
> 500.html template, so the app crashes sending me these messages:
>
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34] mod_wsgi
> (pid=15934): Exception occurred processing WSGI script '/home/edah/
> public_html/meu_blog/index.wsgi'.
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34] Traceback
> (most recent call last):
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]   File "/
> usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line
> 239, in __call__
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]
> response = self.get_response(request)
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]   File "/
> usr/lib/python2.6/site-packages/django/core/handlers/base.py", line
> 128, in get_response
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]     return
> self.handle_uncaught_exception(request, resolver, exc_info)
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]   File "/
> usr/lib/python2.6/site-packages/django/core/handlers/base.py", line
> 160, in handle_uncaught_exception
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]     return
> callback(request, **param_dict)
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]   File "/
> usr/lib/python2.6/site-packages/django/views/defaults.py", line 23, in
> server_error
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]     t =
> loader.get_template(template_name) # You need to create a 500.html
> template.
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]   File "/
> usr/lib/python2.6/site-packages/django/template/loader.py", line 80,
> in get_template
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]     source,
> origin = find_template_source(template_name)
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]   File "/
> usr/lib/python2.6/site-packages/django/template/loader.py", line 73,
> in find_template_source
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]     raise
> TemplateDoesNotExist, name
> [Wed Sep 30 16:27:00 2009] [error] [client 200.198.212.34]
> TemplateDoesNotExist: 500.html
>
> Well, I've played a little with my settings and index.wsgi, but got no
> good results. Someone please help me!?
>
> Thanks a lot!

"# You need to create a 500.html
template."

--~--~-~--~~~---~--~~
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: Is it possible to use custom template tag inside another tag?

2009-10-03 Thread Maksymus007

On Sat, Oct 3, 2009 at 4:01 PM, Andrew  wrote:
>
> Anyway, I thound that's not possible, so I will need to create
> specific custom tag for this.
>
> On Oct 3, 2:07 pm, Andrew  wrote:
>> Hello,
>>
>> is there any way to use custom template tag inside {if} or ifequal
>> tag?
>>
>> I have custom tag "getpreference" which accepts one parameter and
>> returns string value or empty "" string.
>> I want to check if value is not empty inside {if} or maybe {ifequal}
>> tag, how do I do that?
>>
>> {% if getpreference "left_position" %}
>>   
>> {% else %}
>>   
>> {% endif %}

custom tag is a function  - cant you just assing its return in view
into variable and send this variable to template?

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



Modelformsets - check if instance in database

2009-10-09 Thread Maksymus007

I have a model formset to edit / add / delete objects from db. I got
one extra form for adding new objects. How can I distinguish if given
form exists in database ? I mean I need to discard invalid form if it
does not represent real object.

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



Modelformset - disable deletion

2009-10-09 Thread Maksymus007

Its somehow possible to disable deletion for certain forms (models) in formset?

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



Strange SQL Query

2009-11-04 Thread Maksymus007

I'm trying to use modelformset for my model using specified form.
Everything works well unless i try to save forms - ale changes are
saved, but for 22 forms django generates 91 queries (some of them are
for auth, other parts etc - but this number should not exceed 30
counting one query for each form). Nevertheless, i got 22 queries like

SELECT (1) AS "a" FROM "finances"."gates_approvals" WHERE
("finances"."gates_approvals"."gate_approval_id" = 45 AND NOT
("finances"."gates_approvals"."gate_approval_id" = 45 ))

which is totally useless. Did anyone meet such a strange 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: Strange SQL Query

2009-11-04 Thread Maksymus007

On Wed, Nov 4, 2009 at 11:13 AM, Mark L.  wrote:
>
>
>
> On Nov 4, 11:20 am, Maksymus007  wrote:
>> I'm trying to use modelformset for my model using specified form.
>> Everything works well unless i try to save forms - ale changes are
>> saved, but for 22 forms django generates 91 queries (some of them are
>> for auth, other parts etc - but this number should not exceed 30
>> counting one query for each form). Nevertheless, i got 22 queries like
>>
>> SELECT (1) AS "a" FROM "finances"."gates_approvals" WHERE
>> ("finances"."gates_approvals"."gate_approval_id" = 45 AND NOT
>> ("finances"."gates_approvals"."gate_approval_id" = 45 ))
>>
>> which is totally useless. Did anyone meet such a strange behaviour?
>
> Hello
>
> Yes, I've seen this behaviour, all right. This looks like a
> misbehaving uniqueness check and I've seen it happen in the .clean()
> method of the model (in model-validation branch), and, while this is
> certainly not where *you* are seeing it, the queries look just the
> same.
>
> This is the way Django handles uniqueness checks (and, quite frankly,
> this is the only way to do it), however it should not be performed for
> primary keys. If it wasn't a primary key field but some other
> "other_unique_field" the query would look like this 'select (1) as "a"
> from "table" where ("table"."other_unique_field" = 45 and not
> ("table"."id" = 45))', which makes perfect sense to me (this
> observation was made by another django-users member, so I am not the
> one to be thanked here).
>
> Anyway, I haven't (yet) read the source of ModelFormSet, so I can't
> give you any direct advice as to how to get rid of these queries.
> Could you post your model declaration, by the way?
>
> I hope my explanation helped at least a little bit.
>

Sure:

class GatesApprovals(models.Model):
id = models.AutoField(primary_key=True, null=False,
db_column='gate_approval_id')
gate = models.ForeignKey(Gates, null=False, db_column='gate_approval_gate')
period = models.DateField(null=False, db_column='gate_approval_period')
value = models.DecimalField(null=True, default=None, max_digits=5,
decimal_places=2, db_column='gate_approval_value')

def __unicode__(self):
return str(self.gate) + ' / ' + str(self.period)

class Meta:
db_table = 'finances"."gates_approvals'
managed = False

and Gates:

class Gates(models.Model):
gate = models.IntegerField(primary_key=True,db_column='gate_id')
in_value = 
models.DecimalField(default=0,max_digits=4,decimal_places=2,db_column='gate_in_value')
out_value =
models.DecimalField(default=0,max_digits=4,decimal_places=2,db_column='gate_out_value')
out_limit = models.SmallIntegerField(default=0,db_column='gate_out_limit')

shared = models.BooleanField(null=False, default=False,
db_column='gate_shared')

class Meta:
db_table = u'data"."gates'
managed = False

def __unicode__(self):
return str(self.gate)

there is nothing like unique together or something - all those are
handled on database level.

I use modelformset_factory with custom form. First it was pure
ModelForm with meta part (maybe doubling instance managing i thought,
but that was not the case), then ModelForm without meta info - with
the same result. Pure form cannot be used with modelformset_factory.

--~--~-~--~~~---~--~~
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: MultiValueField and MultiWidget

2009-11-04 Thread Maksymus007

widgets = (forms.Select(), forms.TextInput())

you make empty widget, just specify available choices there

On Wed, Nov 4, 2009 at 11:19 AM, psvent  wrote:
>
> Hi!
>
> I am struggling to get  MultiValueField and MultiWidget to work.
>
> I have a CharField and ChoiceField in the MultiValueField class,
> but I can't get the choices to show in the select tag.
>
> Am I doing something wrong?
>
> This is what I have so far:
>
> class AutocompleteWidget(forms.MultiWidget):
>    def __init__(self, attrs=None):
>        widgets = (forms.Select(), forms.TextInput())
>        super(AutocompleteWidget, self).__init__(widgets, attrs=attrs)
>
>    def decompress(self, value):
>        if value:
>            return [value[0], value[1]]
>        return [None, None]
>
> class AutocompleteField(forms.MultiValueField):
>    default_error_messages = {
>        'invalid': _(u'Enter a list of values.'),
>        'required': _(u'Please select or enter an value.'),
>    }
>
>    def __init__(self, *args, **kwargs):
>        choices = kwargs.pop('choices')
>        fields = (forms.ChoiceField(choices=choices), forms.CharField
> ())
>        widget=AutocompleteWidget
>        super(AutocompleteField, self).__init__(fields=fields,
> widget=widget, *args, **kwargs)
>
>    def compress(self, data_list):
>        if data_list not in settings.EMPTY_VALUES:
>            return data_list
>        return None
>
> class TestForm(forms.Form):
>    name = forms.CharField(required=True)
>    description = forms.CharField(required=True, widget=forms.Textarea
> ())
>    selection = AutocompleteField(choices=(('1', '1'), ('2', '2')),
> required=True)
>
> >
>

--~--~-~--~~~---~--~~
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: querysets: if x in y

2009-11-08 Thread Maksymus007

if you use custom user model, you could select user with related sets
and filter out record having at least one FK empty.

I think you could try
a) run own, custom query
b) use extra() function on queryset - but again, it should be used
agains User model
c) use database view

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



Template conceptual help

2009-11-12 Thread Maksymus007
I have some problem with templates and separating templates blocks.

There is a list of messages. Some properties are common, some are
application specific.
Properties are just html columns :)

I got following templates
main.html -> basic "frame", which consists of common html, headers, scripts etc.
frame.html - which introduce additional division - tabs and content,
extends main.html

app_specific.html - app specific tab lists - extends frame.html

messages.html - common message list, which contains common properties
and block in the middle to add custom properites, extends
app_specific.html to be part of app, with proper tabs etc.

app_msg.html - additional properties for messages list, extends messages.html.

My problem is - i need different app_specific.html for different
app_msg.html - is there any way I can achieve that without using
variables from view like context['app_specific_frame'] =
'someapp.html' ? I want to keep clear line between view and
controller.
Any way of simply passing some string along extended templates? Or
possibility to somehow make content of app_msg.html block a content of
extended block from messages.html but wiht extending messages.html?

--

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




Re: Template conceptual help

2009-11-12 Thread Maksymus007
On Thu, Nov 12, 2009 at 1:31 PM, bruno desthuilliers
 wrote:
> On 12 nov, 12:16, Maksymus007  wrote:
>> I have some problem with templates and separating templates blocks.
>>
>> There is a list of messages. Some properties are common, some are
>> application specific.
>> Properties are just html columns :)
>>
>> I got following templates
>> main.html -> basic "frame", which consists of common html, headers, scripts 
>> etc.
>> frame.html - which introduce additional division - tabs and content,
>> extends main.html
>>
>> app_specific.html - app specific tab lists - extends frame.html
>>
>> messages.html - common message list, which contains common properties
>> and block in the middle to add custom properites, extends
>> app_specific.html to be part of app, with proper tabs etc.
>>
>> app_msg.html - additional properties for messages list, extends 
>> messages.html.
>
>
> This indeed makes quite a few layers. But anyway...
>
>> My problem is - i need different app_specific.html for different
>> app_msg.html
>
> Hmmm... Then I'm not sure your layering scheme is appropriate. Do not
> forget that while pretty cool, template inheritance is by no mean the
> only way to factor out / reuse template code. You also have simple
> inclusions and custom templatetags. It's hard to tell without reading
> your code, but it might be possible that getting the "message.html"
> layer out of the inheritance tree and refactoring it as an inclusion
> or custom templatetag solve your problem. If not:
>
>> - is there any way I can achieve that without using
>> variables from view like context['app_specific_frame'] =
>> 'someapp.html' ?
>
> You can't put *anything* before an extends Node, anything in a "child"
> template that's outside a block Node will be just ignored - even if
> it's just a "context extending" node [1] - and there's AFAIK no way to
> pass additional context thru the extends templatetag|2]. So this leave
> you with passing these "params" thru the context, one way or another
> (cf below).
>
> [1] I posted about this on the dev list last year or so - I had a
> working patch but well, I managed to solve my "problem" differently
> (and more cleanly IMHO) so I finally didn't bother opening a ticket
> and submitting the patch.
>
> [2] but while we're at it, I think I once saw some "better extends"
> templatetag somewhere - and well (thinking out loud), FWIW it should
> not be that hard to implement an "extended extends" tag that could
> takes more arguments...
>
>> I want to keep clear line between view and
>> controller.
>
> A bit OT, but in Django, you have views and templates - no
> controllers. But let's not waste time about terminology
> issues !-)
>
> I recently solved a more or less similar (even if probably way
> simpler) problem using the "kwargs" argument to url patterns.
>
> My problem was to pass additional per view project-specific context
> stuff to the templates - stuff that the app's views shouldn't be aware
> of, and that was not necessarily fitted for a ContextProcessor (like,
> which section of the main menu was to be 'hilited' for a given view,
> etc).
>
>
> The solution looks like this (simplified):
>
> 1/ in the project's urls.py, override the app's default urls and pass
> the extra context:
>
> urlpatterns = patterns('',
>    url("^some/pattern/(?P\d+)/$"
>        "app.some_view",
>        name="app_view_name",
>        # project specific extra context here:
>        kwargs={'extra_context':{'active_section_name'}}
>        ),
>     ...
> )
>
> 2/ in the app's views.py:
>
> def some_view(request, model_id, **kwargs):
>   context = dict()
>   # take care of eventual extra context, but without
>   # assuming anything about it:
>   extra_context = kwargs.get("extra_context", None)
>   if extra_context:
>      context.update(extra_context)
>
>   # then proceed as usual to setup the context, render to response
> etc...
>   # normal view code here
>
>
> This of course requires having full control on the app's views (or
> being willing and able to fork the app), but hey, it really helps
> making the app's views code "project-agnostic" for a very low cost.
>
> Don't know if this (or anything else in this post) can be a solution
> to your actual problem, but HTH nonetheless !-)

Well, yes, messages,html can 

Re: Template conceptual help

2009-11-12 Thread Maksymus007
> Yeps, I just knew I had already seens something like that
> somewhere !-)
>
> Ok, problem solved then.

yep :)

>
>> Your solution is way cool, but again, its violates DRY -
>> additional code in every view (can be probably ommited by decorators,
>
> Indeed.
>
>> but still, the same decorator for every view  ;) )
>
> Yeps, I know. But it's the best solution I could came with within the
> 5 minutes I had to solve the problem - and it can eventually solve
> other problems that xextends could not (well, eventually, really - no
> concrete example at hand ATM)

I think that a bit more control over templates - like possibility to
render some template with filled blocks into another block and simple
- some params form URLs directly in the templates - like sections
names, titles would suit there.
Nevertheless, thanks for 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-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=.




Strange reverse behaviour

2009-11-19 Thread Maksymus007
I got my main urls.py file

urlpatterns = patterns('',
(...)
(r'^wakers/$', include('appname.wakers.urls')),
(...)
)

and this works well

then i got wakers.urls.py

urlpatterns = patterns('wakers',
(r'^$', 'views.add', {}, 'wakers-add'),
(r'^b$',  'views.add', {}, 'wakers-add2'),
)

And then in template i try to do

{% url wakers-add %} everything works well, /wakers/ is returned
but
{% url wakers-add2 %} throws "Caught an exception while rendering:
Reverse for 'wakers-add2' with arguments '()' and keyword arguments
'{}' not found."

which should work, just like the wakers-add.

App is in settings.py. Anyone had same problem?

--

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




Strange django behaviour

2009-12-09 Thread Maksymus007
For a few weeks I observe strange django behaviour - from time to time
I get mails about

AttributeError: 'NoneType' object has no attribute 'company'

in line 121, which is:

cursor.execute("SELECT * FROM interface.stats_sms_errors(%d,
'%s'::timestamp with time zone, '%s'::timestamp with time zone, '%s')"
% (request.account.company.company_id, stats_time_start,
stats_time_end, stats_truncate))

looks like request.account is None.

But one line above,line 120 is

cursor.execute("SELECT * FROM interface.stats_sms_mms(%d,
'%s'::timestamp with time zone, '%s'::timestamp with time zone, '%s')"
% (request.account.company.company_id, stats_time_start,
stats_time_end, stats_truncate))

which uses the same request.account which, one line later is empty.

This view is called about 500 times a day and it works, but one or two
times a day it generates aboved message.

Looks like something "wipes" by request objects in the middle of a
view. This additional member of request is initialized in my own
middleware - however its not possible to have this a None value (this
would display user login form, not executing views).

Same situations can be spoted in few other places in code - every time
situations is similar - in line n request.account is object, in line
n+1 its None. What may be important - this always happen in the same
lines.

Does anyone have an idea why this happed, what may couse it? Of course
I tried to debug, but cannot reproduce it.

We use mod_wsgi and apache2 if this matters.

--

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: FK to an Abstract class? Alternative?

2009-12-15 Thread Maksymus007
On Wed, Dec 16, 2009 at 6:21 AM, Victor Hooi  wrote:
> heya,
>
> We have a small project where we need to store a series of exam
> results for students.
>
> Some exams receive a grade out of 100, others are simply a pass/fail,
> while others are given a one-word grade (e.g. pass, fail, credit,
> distinction).
>
> In a sense, they all do map to a 0 to 100 scale (e.g. for the pass/
> fail, you can make it 0 and 100, while the pass/fail/credit/
> distinction can be mapped to other numbers. However apparently the
> users don't want to store it that way, and want them each
> differentiated. Also, I suppose you'd need to store somehow which type
> of mark it was anyway, for when you need to represent it to the user.
>
> I was thinking of setting up abstract models to handle this, something
> like:
>
>    class AssessmentTask(models.Model):
>        name = models.CharField(max_length=20)
>        paper = models.FileField(upload_to='forms/examination')
>        date = models.DateField()
>
>        class Meta:
>            abstract = True
>
>    class GradedAssessmentTask(AssessmentTask):
>        mark = models.CharField(max_length=1,
> choices=ASSESSMENT_GRADE_CHOICES)
>
>    class PassFailAssessmentTask(AssessmentTask):
>        mark = models.BooleanField()
>
>    class NumericalMarkAssessmentTask(AssessmentTask):
>        mark = models.PositiveIntegerField()
>
>    class ExaminationRecord(models.Model):
>        assessment = models.OneToOneField(AssessmentTask)
>
> You could then create overridden methods to handle pass/fail checking
> for each of those. The ExaminationRecord object contains a list of
> assessments, each of which is of type AssessmentTask.
>
> However, Django complains with:
>
>    AssertionError: OneToOneField cannot define a relation with
> abstract class AssessmentTask
>
> So obviously that's not the right way to handle this. What is the
> right way within Django to handle something like this?
>
> Cheers,
> Victor
>

store results as 0-100 integer and use second integer field to
indicate what type of mark it is - then simply convert it - you can
use method of your model

--

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: Extranet : Complete project behind login?

2009-12-16 Thread Maksymus007
On Wed, Dec 16, 2009 at 4:53 PM, Niels  wrote:
> We're developing an extranet.
>
> What is the best (and easiest) way to put a complete project behind a
> login?
>
> I don't want to add @login_required to all views
>
>
> Thanks,
>
>
> Niels

custom context processor?

--

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.




Form field required only if other fields are filled

2009-12-23 Thread Maksymus007
How to impelement such a functionality? I would like to provide full
field validation but only if other field is filled - for example
checkbox is checked. I start with

class Form:
   field = forms.Field(required=False)

but would like to change this to True in some cases at runtime. I know
I can use clean() method of form to od validation, but I embedded some
complex rules in field validation and dont want to repeat the code

--

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 and android application

2010-06-05 Thread Maksymus007
On Sat, Jun 5, 2010 at 10:18 PM, rahul jain  wrote:
> Hi Django,
>
> I would like to create an android application which talks to Django.
> If I hit a url on my phone, it hits one of my views (urlconf), that
> view
> processes the request and give the result back to the android app.
>
> Anybody in the community have any knowledge how to proceed with it
>
> Firstlty, how to hit my Django server from android application
>
> Secondly, how to send back the results.
>
> Any tips, suggestions and design help will be appreciated.
>

yep - hit android SDK :) All your questions concern programming
android, not django

-- 
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: moving to django 1.2.1

2010-07-28 Thread Maksymus007
On Wed, Jul 28, 2010 at 3:29 PM, Massimiliano Ravelli
 wrote:
> On Jul 28, 3:13 pm, knight  wrote:
>> What are the minimal changes that I need to make in order to work with
>> 1.2.1?
>
> Did you have a look at 
> http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges
> ?

This link in worth nothing.
The same all the sentences link '1.1 and 1.2 are compatible'.
They are not.

I have quite big application written in 1.1 - still can't fully run it on 1.2.
As I discovered: forms fields set to be blank=True and null=True when
left blank on 1.1 get null value as expected, on 1.2 the get empty
string - which crashes if database has constraints.

-- 
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: help

2010-08-03 Thread Maksymus007
1 - no
2 - no
3 - no

On Tue, Aug 3, 2010 at 4:57 PM, André Asantos  wrote:
> I am totaly new to Python world...
>
> I would like to konw:
>
> 1- py is Python class extension?
> 2-does django have any similar .jsp GUI? or is only use HTML for GUI?
> 3-is netbeans IDE the best IDE?
>
> --
> 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: override django's rear-end validation for dynamic model field (AJAX)

2009-12-24 Thread Maksymus007
On Thu, Dec 24, 2009 at 5:24 PM, hotani  wrote:
> I have close to 600 users split by 20 or so offices. We have a
> helpdesk form (using ModelForm) which displays an initial user list
> based on the office, or no users if an office is not selected.
>
> An AJAX function on the front end dynamically changes users in the
> drop-down based on the office selection. An admin can change the
> office which will display a new set of users to choose from.
>
> Everything is fine till it comes to django validating the form. Since
> the user selection coming in for processing may not have been one of
> the initial choices, I keep getting the dreaded "That choice is not
> one of the available choices" error.
>
> I can hack this up by first sending all users to the field, then
> erasing and resetting the display on the front end but would like a
> more "standard" solution.
>
> Using clean_user(self) does not work - I can throw errors from there
> but don't seem to have a way to tell django "this value is OK,
> dammit!"
>

how about using int field for user with custom widget and own custom
clean() method which checks if selected user is in range based of
other (office department) field?

--

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: Internationalization

2011-09-22 Thread Maksymus007
and of course you did check django documentation under internationalization
section?:)

Pozdrawiam, Maksymilian Pawlak
22-09-2011 12:30 użytkownik "nadae ivar"  napisał:
> hi,
> i have a application in french i wanna use internationalization to
> change language at each request if the broswer in english turn it in
> english if the broser in french turn it in french
>
> --
> 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.
>

-- 
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: Second coming of Java?

2011-10-13 Thread Maksymus007
What my and company I work for experience show is that Java should simply by
used to solve other problems that Django or RoR solves.
Developing medium-sized web-app in Django is for us big pain in the neck,
especially when compared to development of other app using
Java + PrimeFaces and all enterprise-stuff (Hibernate, ehCache etc).
I don't see Django with Python with their, lets say, community and
non-enterprise grade solutions (good WORKING SOAP library for Python?) is
not suitable for really big thinks, thats all.
On the other side..check Play! Framework for java ;)

On Wed, Oct 12, 2011 at 10:52 PM, ydjango  wrote:

> What do you think?
>
> http://www.cringely.com/2011/10/the-second-coming-of-java/
>
> "When SSDs gain enough capacity there will be a shift from the Ruby
> world back to the Java world. Not for prototyping, because, well, it’s
> prototyping. But simply because the statement “Ruby is incredibly slow
> but I don’t care because my database is slower” will no longer be
> true. At that point Ruby (Python, Groovy, you name it) becomes the
> bottleneck." - from the above article
>
> --
> 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.
>
>

-- 
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: Second coming of Java?

2011-10-13 Thread Maksymus007
On Thu, Oct 13, 2011 at 3:05 PM, Tom Evans  wrote:

> On Thu, Oct 13, 2011 at 1:42 PM, Maksymus007 
> wrote:
> > What my and company I work for experience show is that Java should simply
> by
> > used to solve other problems that Django or RoR solves.
> > Developing medium-sized web-app in Django is for us big pain in the neck,
> > especially when compared to development of other app using
> > Java + PrimeFaces and all enterprise-stuff (Hibernate, ehCache etc).
> > I don't see Django with Python with their, lets say, community and
> > non-enterprise grade solutions (good WORKING SOAP library for Python?) is
> > not suitable for really big thinks, thats all.
> > On the other side..check Play! Framework for java ;)
>
> Only people who are brought up on Java EE/.NET believe SOAP is
> useful/good. The rest of the world (yes, even us Enterprise with a big
> E) prefer simpler REST interfaces.
>
> BTW, it is ironic that you are arguing that python lacks enterprise
> features and give Hibernate as something Java has over Python on a
> Django mailing list. Hibernate is an ORM and object persistence
> library… which is precisely what Django's ORM does.
>
> We implement real world enterprise solutions using Django, and love
> it. Take your FUD elsewhere please!
>

You sound like you never worked for anything that must works with some other
solutions where choice of using SOAP over REST was made years ago.
Hehe, you have right to belive that Django ORM is far better than Hibernate
is, but it lacks lots of features that Hibernate has.

I do not try to FUD, just to say that Django IS NOT silver bullet and in
many real life examples, especially when quality and integration with other
services is to be of of a first class Java is far more advanced by all
means.

It is imporant to use right tool for the jobs, not other way round. If you
need to make rich-component, scalable web application and maintain it for
few years that Java is better solution for me.

And plz, try not to be childlish, its Django mailing list but there is
nothing wrong in saying that Django, again, is not a silver buller for every
possible application.


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

-- 
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: Second coming of Java?

2011-10-13 Thread Maksymus007
On Thu, Oct 13, 2011 at 4:59 PM, Javier Guerra Giraldez
wrote:

> On Thu, Oct 13, 2011 at 9:52 AM, Maksymus007 
> wrote:
> > must works with some other solutions where choice of using SOAP over REST
> > was made years ago.
>
> often because some years ago, REST wasn't a buzzword-compliant
> acronym.  anybody who suggested CRUD-over-HTTP (*) would've been
> quickly vetoed out of the design committee meetings.
>
>
> (*) yes, i know REST is totally not CRUD.  tell that to those
> 'enterprise architects' in the '90s
>
>
True, but that how things are, nothing to argue more about. Django (and
Python in general) do not like SOAP, and it's DJango problem, not SOAP,
whatever some "cool developers who are typically to afraid of new things"
say :/

-- 
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: PUNTARE CON DJANGO SU BILANCIATORE ORACLE ATTRAVERSO IL TSNAME

2011-10-18 Thread Maksymus007
englishoo speakino list only.
18-10-2011 13:15 użytkownik "mxm982"  napisał:

> Ciao ragazzi ho realizzato una piccola applicazione in Django che
> aggiorna delle tabelle di uno schema gia preesistente. Ora ho la
> necessita di puntare al rach della db attraverso appunto il tsname non
> tramite sid come viene richiesto dal file setting.py potete aiutarmi
>
> --
> 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.
>
>

-- 
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: Can't Test Apps Without Models?

2011-05-09 Thread Maksymus007
just create empty models,py file in your app folder. I don't know why,but
thats how Django 'sees' your applications.

Pozdrawiam, Maksymilian Pawlak
09-05-2011 23:58 użytkownik "protonpopsicle" 
napisał:
> Is this a bug?
>
> If I run my unittest with './manage.py test myapp' and myapp does not
> contain a models.py file, the following error results:
>
> django.core.exceptions.ImproperlyConfigured: App with label fogbugz
> could not be found
>
> This error does not describe the problem. Also, shouldn't one be able
> to run tests on apps without models?
>
> --
> 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.
>

-- 
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: Mise en place de la base de données

2011-05-23 Thread Maksymus007
bonjour,le liste est anglais langue seulement.

Pozdrawiam, Maksymilian Pawlak
23-05-2011 13:25 użytkownik "mehdi ben rejeb" 
napisał:
> Bonjour
> je suis novice pour django et l'environnement python
> cet environnement de travail me plaie
> je viens de suivre le tuto :http://docs.django-fr.org/intro/
> tutorial01.html
> et j'ai eu un problème lors de la mise en place de la base de donnée
> j'ai voulu connecter avec postgressql 8.4
> 1-j'accede à setting.py et j'essaye de mettre les parametre
> necessaire
> puis je lance la commande comme indque le tuto :python manage.py
> syncdb
> pour créer les table sauf ca m'affiche une erreur
>
>
> 1-mon fichier setting.py aprés modification:
> # Django settings for inbmi project.
>
> DEBUG = True
> TEMPLATE_DEBUG = DEBUG
>
> ADMINS = (
> # ('Your Name', 'your_em...@example.com'),
> )
>
> MANAGERS = ADMINS
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.postgresql', # Add
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'intrainbmi', # Or path to
> database file if using sqlite3.
> 'USER': 'postgres', # Not used with
> sqlite3.
> 'PASSWORD': 'admin', # Not used with sqlite3.
> 'HOST': '', # Set to empty string for
> localhost. Not used with sqlite3.
> 'PORT': '5432', # Set to empty string for
> default. Not used with sqlite3.
> }
> }
>
> # Local time zone for this installation. Choices can be found here:
> # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
> # although not all choices may be available on all operating systems.
> # On Unix systems, a value of None will cause Django to use the same
> # timezone as the operating system.
> # If running in a Windows environment this must be set to the same as
> your
> # system time zone.
> TIME_ZONE = 'America/Chicago'
>
> # Language code for this installation. All choices can be found here:
> # http://www.i18nguy.com/unicode/language-identifiers.html
> LANGUAGE_CODE = 'en-us'
>
> SITE_ID = 1
>
> # If you set this to False, Django will make some optimizations so as
> not
> # to load the internationalization machinery.
> USE_I18N = True
>
> # If you set this to False, Django will not format dates, numbers and
> # calendars according to the current locale
> USE_L10N = True
>
> # Absolute filesystem path to the directory that will hold user-
> uploaded files.
> # Example: "/home/media/media.lawrence.com/media/"
> MEDIA_ROOT = ''
>
> # URL that handles the media served from MEDIA_ROOT. Make sure to use
> a
> # trailing slash.
> # Examples: "http://media.lawrence.com/media/";, "http://example.com/
> media/"
> MEDIA_URL = ''
>
> # Absolute path to the directory static files should be collected to.
> # Don't put anything in this directory yourself; store your static
> files
> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
> # Example: "/home/media/media.lawrence.com/static/"
> STATIC_ROOT = ''
>
> # URL prefix for static files.
> # Example: "http://media.lawrence.com/static/";
> STATIC_URL = '/static/'
>
> # URL prefix for admin static files -- CSS, JavaScript and images.
> # Make sure to use a trailing slash.
> # Examples: "http://foo.com/static/admin/";, "/static/admin/".
> ADMIN_MEDIA_PREFIX = '/static/admin/'
>
> # Additional locations of static files
> STATICFILES_DIRS = (
> # Put strings here, like "/home/html/static" or "C:/www/django/
> static".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
> )
>
> # List of finder classes that know how to find static files in
> # various locations.
> STATICFILES_FINDERS = (
> 'django.contrib.staticfiles.finders.FileSystemFinder',
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
> )
>
> # Make this unique, and don't share it with anybody.
> SECRET_KEY = 'w$#^b$a%x)ul-#78&dq1+_k$_^gx-&o^3em51_od4)ciwv8wqc'
>
> # List of callables that know how to import templates from various
> sources.
> TEMPLATE_LOADERS = (
> 'django.template.loaders.filesystem.Loader',
> 'django.template.loaders.app_directories.Loader',
> # 'django.template.loaders.eggs.Loader',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> )
>
> ROOT_URLCONF = 'inbmi.urls'
>
> TEMPLATE_DIRS = (
> # Put strings here, like "/home/html/django_templates" or "C:/www/
> django/templates".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
> )
>
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> # Uncomment the next line to enable the admin:
> # 'django.contrib.admin',
> # Uncomment the 

Re: markup

2011-05-26 Thread Maksymus007
yes,its called microsoft word:) it is possible to save file as html,but the
quality and portability of this code is poor

Pozdrawiam, Maksymilian Pawlak
26-05-2011 17:27 użytkownik "Vladimir"  napisał:
> Is there a tool to transform MS WORD file into HTML ? I know there is
> markdown and textile, but I would prefer MS WORD.
> Thank You
>
> --
> 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.
>

-- 
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: Best CSS/JS compressor?

2011-06-02 Thread Maksymus007
we use yui for both js and css. but we have it a bit different,i mean we use
django tag for including files and some script that compress and join files
and both share the same naming algorithm.

Pozdrawiam, Maksymilian Pawlak
02-06-2011 21:08 użytkownik "Mike"  napisał:
> What is everyone using to combine CSS/JS?
>
> Has anyone tried mod_pagespeed? Perhaps Django-Compressor?
>
> All the discussions I found were quite dated.
>
> 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-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.
>

-- 
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: VERY cheap django hosting?

2011-06-07 Thread Maksymus007
megiteam.pl is 24PLN which is about 8usd a month:)

Pozdrawiam, Maksymilian Pawlak
08-06-2011 08:30 użytkownik "raj"  napisał:
> Hey guys,
> Just wondering if you could give me some hosts that are very cheap for
> django hosting? Is hostgator any good? I really don't know what to
> look for in a host. A lot of people are recommending web faction, but
> its around $9 bucks a month. I was looking in the $5 bucks a month
> range. Any ideas? Thank you.
> -Raj
>
> --
> 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.
>

-- 
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/python performance vs play/java

2011-07-05 Thread Maksymus007
Of course Java IS faster by a few factors then Python. I switched recently
to Play development from django and I also noticed different. Moreover Play
uses many mature tools, like JPA/Hibernate, ehcache etc which are called
industrial standards.
One more thing - Play! uses its own build-in http server, and keep one
connection to a database alive at all the time, Django run as FCGI or
mod_wsgi manages this a bit different.

On Tue, Jul 5, 2011 at 9:54 PM, drakkan  wrote:

> Hi,
>
> I did a small test app that basically render a web page and do 3
> queries to the database (these queries are needed to fetch some data
> displayed on the web page). I deployed this app with nginx+uswgi
>
> here is the relevant nginx conf:
>
> location / {
>uwsgi_pass 127.0.0.1:49152;
>include uwsgi_params;
>}
>
> I configured nginx to serve the static files too:
>
> location /media {
>root ;
>autoindex on;
>}
>
> I launch uswgi as follow:
>
> uwsgi --chdir= --
> module='django.core.handlers.wsgi:WSGIHandler()' --env
> DJANGO_SETTINGS_MODULE=myapp.settings --master --pidfile=/tmp/project-
> master.pid --socket=127.0.0.1:49152 --max-requests=5000 --process=5
>
> then I benchmarked the app with ab:
>
> ab -n 1000 -c 4 http://127.0.0.1:80/
> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
> Licensed to The Apache Software Foundation, http://www.apache.org/
>
> Benchmarking 127.0.0.1 (be patient)
> Completed 100 requests
> Completed 200 requests
> Completed 300 requests
> Completed 400 requests
> Completed 500 requests
> Completed 600 requests
> Completed 700 requests
> Completed 800 requests
> Completed 900 requests
> Completed 1000 requests
> Finished 1000 requests
>
>
> Server Software:nginx
> Server Hostname:127.0.0.1
> Server Port:80
>
> Document Path:  /
> Document Length:24293 bytes
>
> Concurrency Level:  4
> Time taken for tests:   28.914 seconds
> Complete requests:  1000
> Failed requests:0
> Write errors:   0
> Total transferred:  24423000 bytes
> HTML transferred:   24293000 bytes
> Requests per second:34.59 [#/sec] (mean)
> Time per request:   115.654 [ms] (mean)
> Time per request:   28.914 [ms] (mean, across all concurrent
> requests)
> Transfer rate:  824.89 [Kbytes/sec] received
>
> Connection Times (ms)
>  min  mean[+/-sd] median   max
> Connect:00   0.1  0   4
> Processing:46  115  42.6110 636
> Waiting:   46  115  42.5109 636
> Total: 46  116  42.6110 636
>
> Percentage of the requests served within a certain time (ms)
>  50%110
>  66%121
>  75%131
>  80%139
>  90%161
>  95%177
>  98%203
>  99%220
>  100%636 (longest request)
>
> now I implemented the same app using playframework, a java based
> framework and benchmarked with ab again:
>
>
> ab -n 1000 -c 4 http://127.0.0.1:9000/
> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
> Licensed to The Apache Software Foundation, http://www.apache.org/
>
> Benchmarking 127.0.0.1 (be patient)
> Completed 100 requests
> Completed 200 requests
> Completed 300 requests
> Completed 400 requests
> Completed 500 requests
> Completed 600 requests
> Completed 700 requests
> Completed 800 requests
> Completed 900 requests
> Completed 1000 requests
> Finished 1000 requests
>
>
> Server Software:Play!
> Server Hostname:127.0.0.1
> Server Port:9000
>
> Document Path:  /
> Document Length:19614 bytes
>
> Concurrency Level:  4
> Time taken for tests:   4.436 seconds
> Complete requests:  1000
> Failed requests:0
> Write errors:   0
> Total transferred:  19961000 bytes
> HTML transferred:   19614000 bytes
> Requests per second:225.44 [#/sec] (mean)
> Time per request:   17.743 [ms] (mean)
> Time per request:   4.436 [ms] (mean, across all concurrent
> requests)
> Transfer rate:  4394.59 [Kbytes/sec] received
>
> Connection Times (ms)
>  min  mean[+/-sd] median   max
> Connect:00   0.0  0   1
> Processing: 7   18   6.6 16  47
> Waiting:6   17   6.6 16  47
> Total:  7   18   6.6 16  47
>
> Percentage of the requests served within a certain time (ms)
>  50% 16
>  66% 19
>  75% 22
>  80% 23
>  90% 27
>  95% 30
>  98% 34
>  99% 38
>  100% 47 (longest request)
>
>
> so play is outperforming django! obviously django is not in debug mode
> ecc..., is there something wrong in my test setup (I already tried to
> adjust the uwsgi launch line I tryed more process or 1 process with
> threads ecc with no relevant improvement) or django/python is simply
> 

Re: Custom SQL questions

2010-12-19 Thread Maksymus007
you get array of arrays.
First array contains rows. Every row is just an array of fields, order is
the same as in your query.

On Sun, Dec 19, 2010 at 9:45 PM, Andy  wrote:

> I need  to execute some SQL queries involving joins and it seems like
> custom SQL is the way to go. A couple of  questions:
>
> 1) In the doc  (http://docs.djangoproject.com/en/1.2/topics/db/sql/
> #executing-custom-sql-directly) there's an example:
> cursor.execute("SELECT foo FROM bar WHERE baz = %s", [self.baz])
> What is the "self.baz" argument? What does it do?
>
> 2) After I execute a SELECT query, how do I access the different
> fields and different rows of the results?
>
> 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.
>
>

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