CKEDITOR not working on certain models

2015-04-21 Thread Thomas Weholt
I've used CKEDITOR to turn my models.TextArea() fields into nice editors
for a long time, but suddenly some of my pages throws the following
exception:

Uncaught Error: The specified element mode is not supported on element:
"meta".

I've googled it and tried several solutions, like:

CKEDITOR.dtd.$editable.textarea = 1
CKEDITOR.replace('description');


in my document_ready-section of my page, but it still doesn't work.

The problem only applies to some models and they all share the same
abstract superclass. I cannot figure out why a javascript-package, running
in the browser, handling the exact same html as before should suddenly stop
working because I added some fields using an abstract model with fields not
even being rendered on the page which has now stopped working.

Any hints?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACkDSm-pckBicvSJNYyepSAAC92CPzKZq8xm5iZqWfzMd8gNOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Custom model field and custom widget

2015-01-30 Thread Thomas Weholt
Hi,

I need to create a custom django model field, a varchar(10) field which has 
a calculated value set on save on the model using it and then never 
changed. This should happen automatically. This field should appear as 
hidden or read-only in forms and it would be nice to handle the render 
output if the field is accessed in templates. The calculated value 
generated on save must access the database and look into a seperate table 
to calculate its value, ie. I need to control the generation of the value 
it gets.

Any ideas or hints?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/282086f4-31fc-47c7-9d6b-62fd8e05e556%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Is there a complete pinax-based or similar starter project available?

2014-03-01 Thread Thomas Weholt
Is there a complete pinax-based (with all the pinax apps installed
including templates) or similar starter project available? I'm looking for
a starter project with social features similar to facebook and the
pinaxproject is the closest I've come so far.

Is pinax still in development? What is the current status of the project?
Are there other projects to base a social site on, similar to pinax?



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACkDSm83s4HxhpapkZSnVoBVk0QEGLNC8Li1YOLykdMUW67h%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Debug Toolbar 1.0 beta released

2013-12-16 Thread Thomas Weholt
I'm especially happy to see support for Python 3. Very nice.



On Sun, Dec 15, 2013 at 2:11 PM, Aymeric Augustin <
aymeric.augustin.2...@polytechnique.org> wrote:

> Hello,
>
> I'm happy to annonce that we're almost ready to release version 1.0 of the
> Debug Toolbar! Now we need your help to try the beta:
>
> https://github.com/django-debug-toolbar/django-debug-toolbar/releases/tag/1.0-beta
>
> The documentation is available on Read the Docs — make sure you read the
> "latest" version as there are many changes since 0.11:
> http://django-debug-toolbar.readthedocs.org/en/latest/
>
> Note that the setup process is different from previous versions:
>
> http://django-debug-toolbar.readthedocs.org/en/latest/installation.html#quick-setup
>
> Please report issues on GitHub:
> https://github.com/django-debug-toolbar/django-debug-toolbar/issues
>
> If no major problems are found, we'll release 1.0 in one week.
>
> Here are the main changes from version 0.9.x and earlier. (Versions 0.10
> and 0.11 were transitory versions leading to 1.0; they were released to
> validate some choices before committing to support them for the lifetime of
> 1.x.)
>
> - Panels are now rendered on demand, solving the "20MB HTML page" problem
> - Panels can be individually disabled from the frontend, in case a panel
> degrades performance severely on a page
> - Interception of redirects can be toggled from the frontend
> - The handle can be dragged along the right side, in case it hides exactly
> the part of the page you're working on :-)
> - Static files are managed with django.contrib.staticfiles, solving a
> series of URL-related issues
> - The setup process was rewritten, to provide a simplified automatic setup
> and an optional explicit setup
> - Panels and settings received shorter or better names
> - A stable API for third-party panels is documented
> - The core of the toolbar was simplified drastically and almost all the
> code was refactored into panels
> - The toolbar was made compatible with all current versions of Django and
> Python, including Python 3.
> - The test suite was expanded and gained Selenium tests
> - Dozens of bugs were fixed
>
> I hope you'll like it!
>
> --
> Aymeric.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2d498dbe-3880-4986-9dc6-a4f7a68ed1b6%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACkDSm9fbsDz5awxDERxHxvBNq5VA76YmdDGfs_BSCmz60_9nQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Python 3

2013-10-23 Thread Thomas Weholt
My main reason to porting as many as possible of my python projects to
Python 3 is proper unicode support. As a Norwegian developer is been
terrible to support local characters in some projects with lots of dirty
hacks to get it working. In py3 it just works.

Thomas


On Wed, Oct 23, 2013 at 5:36 PM, Lee  wrote:

> Is there any particular advantage of using Python 3 at this point
> specifically in regards to Django projects? I'm starting to build a new
> application and I am wondering whether its really worth considering the
> move to Python 3. I've only really read about the disadvantages (3rd party
> libs mainly) and have seen very little relating to any specific advantages.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fcab2249-1b88-405a-9106-dd2b544d3d07%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACkDSm9X7zaJDDK3LgLZcsWmPxx0qJW_e7%3D%3D7SWC_fXf7-2jxw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to make set background image for printout layout

2013-06-13 Thread Thomas Weholt
Do a quick google-search and you'll get plenty of tutorials, for instance
http://www.w3schools.com/css/css_background.asp. It seems to require some
setup on the client side as well, actually enabling printing backgrounds in
your browser settings/print preferences. Read more about it here:
http://bytes.com/topic/html-css/answers/465772-how-force-print-css-background-image

PS! This question is not django-specific. You'll probably get faster and
better results trying in a more appropriate group or forum.

Thomas


On Thu, Jun 13, 2013 at 2:12 PM, Sivaram R  wrote:

> Hi,i am doing printers,print-out functionality.So the data what ever i
> want to print are rendered in a template called print.html.So while
> method call it is rendering that template as print-out format.I don't know
> how to set a background image for that print-out template.Is it same as
> table background set in html/or how to set a background image for print
> template.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: background image for table not apply in printout page and email copy - Django

2013-06-13 Thread Thomas Weholt
My first suggestion would be to see what {{ STATIC_URL }} renders as in
your browser. Another thing; if you want to use this template to generate
emails, IP-addresses starting with 192.168.x.x would not work because they
are reserved for internal networks AFAIK. The image would have to be
available for users outside your network for it to be displayed correctly
in an email.

PS! - This problem is not django specific and should be posted to a group
more aimed at webdevelopment in genereal.

Thomas



On Thu, Jun 13, 2013 at 11:19 AM,  wrote:

> html:
>
> 
>  
>
>{%if injuary_mark.mark1 %}
> {% endif %}
>
>{%if injuary_mark.mark2 %} {% endif %}
>
>
>
> 
>
> css:
>
> .printout{
> background:url('http://192.168.100.10/static/images/human.png');
> width:123px;
> height:298px;
> background-position:center;
> background-color: transparent;
> background-repeat: no-repeat;
> vertical-align:middle;
> border: none;
> }
>
> The above html and css is for print-out template.Problem is if i press
> print button,print preview is coming but without background image.I am
> sending the same template as email,facing same problem  while sending email
> also.The image is not displayed in email copy also.
>
> I tried giving the direct url of image also,still the problem not solved.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How does it all work

2013-06-10 Thread Thomas Weholt
I'd take a look at the standard python docs, especially the things about
wsgi and httpserver, but this question is not django-specific so you might
have better look asking in a more python-specific forum, like
comp.lang.python (
https://groups.google.com/forum/?fromgroups#!forum/comp.lang.python )

There's a long way and lots of codelines from a basic "Hello world" webapp
to a framework like django, but you'll learn alot by starting with the
standard webrelated stuff in standard python.

Thomas


On Mon, Jun 10, 2013 at 4:10 PM, Nafiul Islam wrote:

> Hi!
>
> I've been using django for a little bit, and I gotta say I love the
> framework. But here's the thing, I don't know how it works. How everything
> fits together. So, what I wanted to ask is how does it all work? Say you
> have a server, and you have Python installed on it. How would you go about
> making a simple hello world web page, without django?
>
> I would be grateful to any link to a comprehensive resource, that shows
> you how to make a simple Hello World webpage, from how you install software
> that you need to writing pure python (without a framework) that can handle
> requests, and work with databases.
>
> I guess, what I'm asking is how do you make a very very basic website
> using Python, from start to finish on a server?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Please help me in Django

2013-06-10 Thread Thomas Weholt
First of all; have you followed the python tutorial and a good grasp on
python in general? If not, do a quick read of the python docs before trying
to learn django.

You'll have to install django after downloading it. Unpack django, cd into
the new django-folder and do a

python setup.py install

Then read the official django tutorial/docs. They are all exceptionally
good and should get you going.

Thomas


On Mon, Jun 10, 2013 at 12:57 PM, Abhimanyu Choithramani <
life.abhi.l...@gmail.com> wrote:

> I downloaded Python 2.7.5 and it started working.
> And I downloaded Django 1.5.1 BUT I am not being able to start it.
> Can someone please guide me step by step..
> PLEASE please please..
>
> Would be obliged if I also get a voice guidance over Skype.
>  my skype id is:  abhimanyu.choithramani89
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re-usable app for REST API creation with Python 3 support?

2013-04-22 Thread Thomas Weholt
I'm looking for a re-usable app for django that can help create a REST-ful
API, but when trying to install django-piston and django-tastypie in my
Python 3.3 virtual environment they both fail.

Are there other alternatives? Are they suppose to work under Python 3.3 or
am I doing something wrong?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: IDE to practice django template language

2013-04-19 Thread Thomas Weholt
I have no experience in WingIDE, but PyCharm supports django development
with intregrated starting of server, running of unittests, running of
commands like syncdb etc. That was a terribly sales-pitch, but search
google or youtube and you'll find videos demonstrating its features.

Thomas


On Fri, Apr 19, 2013 at 3:35 PM, Tim Cook  wrote:

>
>
> On Fri, Apr 19, 2013 at 9:01 AM, Thomas Weholt wrote:
>
>> PyCharm! Allthough commercial - it's great and really worth the prize,
>> and now is on sale for half prize!
>>
>>
>>
> Hi Thomas,
>
> I am a long time WingIDE user and although it supports Django quite well I
> am wondering if you can contrast it with Pycharm?  The latter says it has
> support for web development with Django integrated.  Can you comment on
> that?
>
> Any disclosures?
>
> Thanks,
> Tim
>
>
> --
> 
> Timothy Cook, MSc   +55 21 94711995
> MLHIM http://www.mlhim.org
> Like Us on FB: https://www.facebook.com/mlhim2
> Circle us on G+: http://goo.gl/44EV5
> Google Scholar: http://goo.gl/MMZ1o
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: IDE to practice django template language

2013-04-19 Thread Thomas Weholt
PyCharm! Allthough commercial - it's great and really worth the prize, and
now is on sale for half prize!




On Fri, Apr 19, 2013 at 1:52 PM, Avraham Serour  wrote:

> I really like pycharm <http://www.jetbrains.com/pycharm/> , you should
> give it a try
>
>
> On Fri, Apr 19, 2013 at 6:42 AM, Apokalyptica Painkiller <
> apokalyptic...@gmail.com> wrote:
>
>> Now i'm using this: http://ninja-ide.org/. I don't know if this is what
>> you need, but why don't you try it.
>>
>> See you
>>
>>
>> 2013/4/18 Srinivasa Rao 
>>
>>> Hi, I am new to this djnago, can you suggest any
>>> development environment to practice template language. thanks,Srini
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>>
>> --
>> I live each day
>> Like it's my last
>> I live for rock and roll
>> I never look back
>>
>> I'm a rocker
>> Do as I feel as I say
>> I'm a rocker
>> And no one can take that away
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What to Django people have to say about Javascript frameworks to complement Django's philosophy on the front end

2013-04-17 Thread Thomas Weholt
vascript frameworks are, and to encourage
>> discussion about this that might be useful to a lot of django people
>> looking to bridge the front end with backend. Feel free to stretch the
>> boundaries of my questions if you even think I've given any clear
>> boundaries, assume that you know more than I, and if you're wrong, no
>> worries, this discussion is as much for your education as it is for mine.
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Status of Django with Python 3.x

2013-04-11 Thread Thomas Weholt
I develop my current project with python 2.7 and 3.3 and so far my problem
is not with django being 3.x compatible but critical/popular third-party
packages like PIL, django-debug-toolbar etc not being python 3 ready. I
hope those and several other packages will be ported to python 3, since
Python 3 has some very nice features not available in 2.x and it solves all
my unicode issues being a programmer which often deal with non-english
characters.

So far I've had no problems using python 3 and django. All problems I've
encountered has been caused by thrid-party packages, my own packages
included :-|


On Thu, Apr 11, 2013 at 3:36 PM, Mark Lybrand  wrote:

> I understand that there is only experimental support for Python 3.x in
> Django 1.5.  Is there any feeling for how far out a stable version of
> Django using Python 3.x might be?  I understand that any answer is likely
> to be conjecture and guessing and that is okay.  I am just trying to gauge
> if I am looking at a matter of months or a year or if it something that may
> be 3 or 5 or more years out.
>
> Thanks in advance.
>
> --
> Mark :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Suddenly manage.py syncdb fails with 'no such table django_session'

2013-04-09 Thread Thomas Weholt
I've later discovered that, in my case, one of my other packages, which
monkey patches my models, most likely is the cause of the problem.

Thomas


On Tue, Apr 9, 2013 at 12:41 PM, Serdar Dalgic  wrote:

> On Thu, Apr 4, 2013 at 10:24 PM, Thomas Weholt 
> wrote:
> > I haven't changed settings.py since my last successful run. I've also
> > googled the problem (and it seem to pop up once in a while), but none of
> the
> > solutions provided solved the problem. I've also made the path to the
> > databasefile absolute, like so:
> >
> > import os
> > PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
> > DATABASES = {
> > 'default': {
> > 'ENGINE': 'django.db.backends.sqlite3',
> > 'NAME': os.path.join(PROJECT_PATH, 'database.db'),
> > 'USER': '',
> > 'PASSWORD': '',
> > 'HOST': '',
> > 'PORT': '',
> > }
> > }
>
> Just a guess, can you try writing to another path? I mean smt like
> this. 'NAME': os.path.join('/tmp', 'database.db'),
>
> I've checked the stackoverflow questions about this issue too, I guess
> there could be a problem about writing on the same path, but I don't
> have a valid explanation. :)
>
> --
> - Serdar Dalgıç 
> FLOSS Developer, Life & Nature Hacker
> twitter: https://twitter.com/serdaroncode
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Suddenly manage.py syncdb fails with 'no such table django_session'

2013-04-04 Thread Thomas Weholt
I'm using django 1.5.1, python 2.7.3, ubuntu 12.10 and sqlite. My project
has been running flawlessly, but I added a database field, deleted my
sqlite database-file and ran python manage.py syncdb. Now it suddenly fails
with

DatabaseError: no such table: django_session.

I haven't changed settings.py since my last successful run. I've also
googled the problem (and it seem to pop up once in a while), but none of
the solutions provided solved the problem. I've also made the path to the
databasefile absolute, like so:

import os
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_PATH, 'database.db'),
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}

What's going on?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django notification like facebook

2013-03-18 Thread Thomas Weholt
On Mon, Mar 18, 2013 at 2:56 PM, Randa Hisham  wrote:
> what is the best django app for executinng realtime notification

WebSockets or ajax polling? Don't know of any app for it though.

Thomas


>
> --
> Randa Hesham
> Software Developer
>
> Twitter:@ro0oraa
> FaceBook:Randa Hisham
>
> ٍ
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Profiling django apps using Python 3? No hotspot module.

2013-03-14 Thread Thomas Weholt
Thanks a bunch :-) Got it working in python 3 with minor tweaking.

Thomas

On Thu, Mar 14, 2013 at 3:09 PM, Shawn Milochik  wrote:
> I use this and it's great. I haven't tried it with Python 3, but it's
> all standard library stuff.
>
> I tweaked mine a bit so it dumps the profile files to my temp folder
> instead of the way it works by default. That's because I wanted to
> profile AJAX calls, keep multiple runs for the same sites for A/B
> comparisons, and because I don't have to know in advance I'm going to
> want to profile something. I can always just look at the file for
> anything I just did.
>
> https://gist.github.com/1229681
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Profiling django apps using Python 3? No hotspot module.

2013-03-14 Thread Thomas Weholt
I've tried to find middleware for django or other methods of profiling
my django apps, but most of them seem to use the hotspot module and
since I use Python 3 and there's no hotspot module in Python 3 I was
wondering if anybody out there had a working profiler for django
compatible with Python 3?

If not I'll try to port one of the ones I've found but why re-invent the wheel?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Announcement: django-quickview 0.3 - putting the nitro in rapid web development

2013-02-28 Thread Thomas Weholt
On Thu, Feb 28, 2013 at 4:10 PM, Tom Evans  wrote:
> On Wed, Feb 27, 2013 at 7:39 PM, Thomas Weholt  
> wrote:
>> pypi : https://pypi.python.org/pypi/django-quickview/
>> Source at https://bitbucket.org/weholt/django-quickview
>>
>> Documentation and tutorial at
>> https://bitbucket.org/weholt/django-quickview/src/fde97a0a0befaeda0ab2317035f8e7cd9c311511/docs/basic.md?at=default
>> for details.
>>
>> Bring on the flames ;-)
>>
>
> Not a flame :)
>
> It would be cooler if you did not have to pollute model classes by
> decorating them with view information. I'd prefer to denote that
> FooModel has fast views *not* in models.py :)

There's an option NOT to use the decorator and keep the ModelViews in
views.py allready as shown in the documentation. I'm going to improve
the decorating options a little bit, but I agree it's nicer to
seperate code related to model and view.

>
> For updating instances, you could make it compulsory to list the
> changed attributes. Then, only the listed attributes are updated.

I've updated the api today so that you can provide just the params you
want to update. It requires a call to the server to get the existing
values, but that can also be avoided by providing the update-call with
a dictionary with the existing values.

>
> Apart from that, looks great. Will probably use this as scaffolding in
> my next HTML5 app.

That's great news. It's still bit of a proof-of-concept thing, but it
has allready saved me lots of time and the coming improvements planned
for version 0.4 will make it even nicer, especially for HTML5 apps
focusing heavy on javascript and dynamic web pages.

My two main concerns are speed and if there are any part of the
implementation that's dangerous in regards to threads, concurrency
etc.

>
> Cheers
>
> Tom



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Announcement: django-quickview 0.3 - putting the nitro in rapid web development

2013-02-28 Thread Thomas Weholt
Packaging python is hard!! Fixed the problem now.

pip install django-quickview works.

Sorry.

Thomas

On Thu, Feb 28, 2013 at 5:03 AM, Bino Oetomo  wrote:
>
>
> On Feb 28, 2:39 am, Thomas Weholt  wrote:
>>
>> Documentation and tutorial 
>> athttps://bitbucket.org/weholt/django-quickview/src/fde97a0a0befaeda0ab...
>> for details.
>>
> Some how I failed to install .
> The pip log pasted at http://pastebin.com/ZNcc8CuH
>
> Sincerely
> -bino-
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Announcement: django-quickview 0.3 - putting the nitro in rapid web development

2013-02-27 Thread Thomas Weholt
pypi : https://pypi.python.org/pypi/django-quickview/
Source at https://bitbucket.org/weholt/django-quickview

Documentation and tutorial at
https://bitbucket.org/weholt/django-quickview/src/fde97a0a0befaeda0ab2317035f8e7cd9c311511/docs/basic.md?at=default
for details.

Bring on the flames ;-)

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANNOUNCE: Django 1.5 released

2013-02-26 Thread Thomas Weholt
I've been using 1.5rc2 for a while now with no problems so getting a
final of 1.5 is great news. I especially like the support for Python 3
since it removes all of my unicode problems. Being a Norwegian
programmer having to deal with those damn øæå-characters all the time
has been a real pain. Now if only the django-debug-toolbar and PIL
could be ported to Python 3 as well all my problems would be solved
;-)

Great work!

Thomas

On Tue, Feb 26, 2013 at 10:56 PM, william ratcliff
 wrote:
> Kudos!   I'm really excited about this version and the new User model!!!
>
>
> On Tue, Feb 26, 2013 at 3:08 PM, Mark Furbee  wrote:
>>
>> Woo-hoo! Awesome news. We really appreciate all the hard work you guys
>> have been doing getting this version out.
>>
>> Thanks a million!
>>
>> Mark
>>
>>
>> On Tue, Feb 26, 2013 at 11:44 AM, James Bennett 
>> wrote:
>>>
>>> Yup, it's finally here!
>>>
>>> * Announcement blog post here:
>>> https://www.djangoproject.com/weblog/2013/feb/26/15/
>>> * Release notes here: https://docs.djangoproject.com/en/1.5/releases/1.5/
>>> * Download it here: https://www.djangoproject.com/download/
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: error in templates...

2013-02-19 Thread Thomas Weholt
It means you haven't added any url matching / in your urlconfig, but
it's hard to give a good answer without a bit more information. Have
you completed the django tutorial which explains how these things
work?

Thomas

On Tue, Feb 19, 2013 at 11:04 AM, Avnesh Shakya  wrote:
> Hello, I'm stuck in teplagte page. error is occuring here after
> runserver..
>
> error..
>
>  NoReverseMatch at / Reverse for '' with arguments '()' and keyword
> arguments '{}' not found.
>
> I can't figure out why I'm getting the error, plz tell me, i have totally
> confused here.
>
>
> thanks
>
> avnesh shakya
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




django-quickview v0.1 released - proof-of-concept/comments wanted

2013-02-18 Thread Thomas Weholt
Hi,

I looked for django-announcements to post this in, but didn't find at
groups.google.com. If this is not the place for such announcements I'm
sorry. Anyway;

Being somewhat underwhelmed by class based views due to the repetative
coding in urls.py etc I tried to see if I could get generic
scaffolding and basic views up and running based on a given model in
less lines of code. It's pretty simple and not heavily tested, but I'd
like to see if any of you has any inital comments before I spend a lot
of time on it.

The idea is that we always write the same views for alot of our
models; a list view, a detail view and add/update/delete. My
app/urls.py seem to have repeating patterns for all these views.
Generic views, class based or plain functions, do help but I still
find all the coding a bit redundant. In essence the templates are the
only thing that I really have to code manually.

Using quickview you define your model like so :


class Person(models.Model):
name = models.CharField(max_length=30)
age = models.IntegerField(default=10)

In views.py:

from models import Person
from quickview import QuickView

class PersonView(QuickView):
model = Person

And in urls.py:

from views import PersonView

# after your other patterns:
urlpattern += YourView.get_urls()


After a little syncdb and runserver you'll have an urlconfig/pattern
something like this:

myapp/person/list/$ [name='myapp-person-list']
myapp/person/add/$ [name='myapp-person-add']
myapp/person/(?P\d+)/$ [name='myapp-person-detail']
myapp/person/update/(?P\d+)/$ [name='myapp-person-update']
myapp/person/delete/(?P\d+)/$ [name='myapp-person-delete']

where myapp is the app my person-models resides in. Now you define
some templates ( list.html, detail.html, add.html, update.html,
delete.html ) in /templates/myapp/person/ and you're good to go ;-).


Todos: user authentication/login_required etc. and unittests.

The code is available at pypi ( pip install django-quickview ) or you
can browse the source at
https://bitbucket.org/weholt/django-quickview. The testsite-folder at
bitbucket contains a working example.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django 1.5 & Python 3 - porting packages to Python3

2013-02-15 Thread Thomas Weholt
Hi,

As a Norwegian user of Django and python user I've spent countless
hours dealing with unicode-problems. As I ported DSE to Python 3 a
while ago I also discovered that all my unicode problems were solved
if I started using Python 3. Probably old news to most of you, or
maybe not even relevant, but it's a make-or-break-situation for me and
my potential users and customers. So all my latest django-based
projects have been developed using Python 3.3 with great success.

But the only problem now is the lack of python-packages supporting
Python 3, mainly PIL ( or the pil-fork pillow ), django-debug-toolbar,
django-celery etc.

Are there any focus in the community on getting packages ready for python3?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: plz help me i have checked many time but i could not find error place.....

2013-02-06 Thread Thomas Weholt
Have you executed python manage.py syncdb?

Thomas

On Wed, Feb 6, 2013 at 2:22 PM, Avnesh Shakya  wrote:
>
> I have checked many time, even i have deleted my project n i have created
> new project again and create new model but error is occurred again n again..
> i m beginner so plz help me
>
> C:\mysite>python manage.py shell
> Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
>>>> from polls.models import Poll,Choice
>>>> Poll.objects.all()
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Python27\lib\site-packages\django\db\models\query.py", line 72,
> in __repr__
> data = list(self[:REPR_OUTPUT_SIZE + 1])
>   File "C:\Python27\lib\site-packages\django\db\models\query.py", line 87,
> in __len__
> self._result_cache.extend(self._iter)
>   File "C:\Python27\lib\site-packages\django\db\models\query.py", line 291,
> in iterator
> for row in compiler.results_iter():
>   File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py",
> line 763, in results_iter
> for rows in self.execute_sql(MULTI):
>   File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py",
> line 818, in execute_sql
> cursor.execute(sql, params)
>   File "C:\Python27\lib\site-packages\django\db\backends\util.py", line 40,
> in execute
> return self.cursor.execute(sql, params)
>   File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py",
> line 344, in execute
> return Database.Cursor.execute(self, query, params)
> DatabaseError: no such table: polls_poll
>>>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unicode/Non-ASCII characters in the admin throws exception

2013-01-29 Thread Thomas Weholt
Sort of solved this issue myself; my solution was using Django 1.5c and 
Python 3.3. 

Allthough this means some of the reusable apps I was planning on using 
isn't ready for Python 3 I'll look into forking them and try to see if I 
can get them running myself. And if so send a patch to the maintainers. 
First up; Django debug toolbar :-)

Thomas


On Monday, January 28, 2013 10:07:22 PM UTC+1, Thomas Weholt wrote:
>
> This is a recurring problem for django users obviously by the amount of 
> posts returned by google and I've had this problem in the past as well, but 
> cannot remember how I got around it. Googling did'nt help either.
>
> When I use Norweian characters like ØÆÅ in CharField-field in the django 
> admin I get an exception when I click the add-button to register the new 
> entry.
>
> Traceback:
> File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in 
> get_response  136. response = response.render()File 
> "C:\Python27\lib\site-packages\django\template\response.py" in render  
> 104. self._set_content(self.rendered_content)File 
> "C:\Python27\lib\site-packages\django\template\response.py" in 
> rendered_content  81. content = template.render(context)File 
> "C:\Python27\lib\site-packages\django\template\base.py" in render  140.   
>   return self._render(context)File 
> "C:\Python27\lib\site-packages\django\template\base.py" in _render  134. 
> return self.nodelist.render(context)File 
> "C:\Python27\lib\site-packages\django\template\base.py" in render  823.   
>   bit = self.render_node(node, context)File 
> "C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
> 74. return node.render(context)File 
> "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render  
> 123. return compiled_parent._render(context)File 
> "C:\Python27\lib\site-packages\django\template\base.py" in _render  134. 
> return self.nodelist.render(context)File 
> "C:\Python27\lib\site-packages\django\template\base.py" in render  823.   
>   bit = self.render_node(node, context)File 
> "C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
> 74. return node.render(context)File 
> "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render  
> 123. return compiled_parent._render(context)File 
> "C:\Python27\lib\site-packages\django\template\base.py" in _render  134. 
> return self.nodelist.render(context)File 
> "C:\Python27\lib\site-packages\django\template\base.py" in render  823.   
>   bit = self.render_node(node, context)File 
> "C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
> 74. return node.render(context)File 
> "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render  
> 123. return compiled_parent._render(context)File 
> "C:\Python27\lib\site-packages\django\template\base.py" in _render  134. 
> return self.nodelist.render(context)File 
> "C:\Python27\lib\site-packages\django\template\base.py" in render  823.   
>   bit = self.render_node(node, context)File 
> "C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
> 74. return node.render(context)File 
> "C:\Python27\lib\site-packages\django\template\defaulttags.py" in render  
> 281. return nodelist.render(context)File 
> "C:\Python27\lib\site-packages\django\template\base.py" in render  823.   
>   bit = self.render_node(node, context)File 
> "C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
> 74. return node.render(context)File 
> "C:\Python27\lib\site-packages\django\template\loader_tags.py" in render  
> 62. result = block.nodelist.render(context)File 
> "C:\Python27\lib\site-packages\django\template\base.py" in render  823.   
>   bit = self.render_node(node, context)File 
> "C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
> 74. return node.render(context)File 
> "C:\Python27\lib\site-packages\django\template\defaulttags.py" in render  
> 281. return nodelist.render(context)File 
> "C:\Python27\lib\site-packages\django\template\base.py" in render  823.   
>   bit = self.render_node(node, context)File 
> "C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
> 74.

Unicode/Non-ASCII characters in the admin throws exception

2013-01-28 Thread Thomas Weholt
This is a recurring problem for django users obviously by the amount of 
posts returned by google and I've had this problem in the past as well, but 
cannot remember how I got around it. Googling did'nt help either.

When I use Norweian characters like ØÆÅ in CharField-field in the django 
admin I get an exception when I click the add-button to register the new 
entry.

Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in 
get_response  136. response = response.render()File 
"C:\Python27\lib\site-packages\django\template\response.py" in render  104. 
self._set_content(self.rendered_content)File 
"C:\Python27\lib\site-packages\django\template\response.py" in 
rendered_content  81. content = template.render(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in render  140. 
return self._render(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in _render  134.   
  return self.nodelist.render(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in render  823. 
bit = self.render_node(node, context)File 
"C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
74. return node.render(context)File 
"C:\Python27\lib\site-packages\django\template\loader_tags.py" in render  
123. return compiled_parent._render(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in _render  134.   
  return self.nodelist.render(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in render  823. 
bit = self.render_node(node, context)File 
"C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
74. return node.render(context)File 
"C:\Python27\lib\site-packages\django\template\loader_tags.py" in render  
123. return compiled_parent._render(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in _render  134.   
  return self.nodelist.render(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in render  823. 
bit = self.render_node(node, context)File 
"C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
74. return node.render(context)File 
"C:\Python27\lib\site-packages\django\template\loader_tags.py" in render  
123. return compiled_parent._render(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in _render  134.   
  return self.nodelist.render(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in render  823. 
bit = self.render_node(node, context)File 
"C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
74. return node.render(context)File 
"C:\Python27\lib\site-packages\django\template\defaulttags.py" in render  
281. return nodelist.render(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in render  823. 
bit = self.render_node(node, context)File 
"C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
74. return node.render(context)File 
"C:\Python27\lib\site-packages\django\template\loader_tags.py" in render  
62. result = block.nodelist.render(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in render  823. 
bit = self.render_node(node, context)File 
"C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
74. return node.render(context)File 
"C:\Python27\lib\site-packages\django\template\defaulttags.py" in render  
281. return nodelist.render(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in render  823. 
bit = self.render_node(node, context)File 
"C:\Python27\lib\site-packages\django\template\debug.py" in render_node  
74. return node.render(context)File 
"C:\Python27\lib\site-packages\django\template\debug.py" in render  84. 
output = self.filter_expression.resolve(context)File 
"C:\Python27\lib\site-packages\django\template\base.py" in resolve  599.   
  new_obj = func(obj, *arg_vals)File 
"C:\Python27\lib\site-packages\django\template\defaultfilters.py" in _dec  
39. args[0] = force_unicode(args[0])File 
"C:\Python27\lib\site-packages\django\utils\encoding.py" in force_unicode  
74. s = unicode(str(s), encoding, errors)
Exception Type: UnicodeEncodeError at /admin/storyquest/story/11/Exception 
Value: 'ascii' codec can't encode character u'\xd8' in position 0: ordinal 
not in range(128)

I'm running Python 2.7.3, django 1.4.3 on Windows 8 64bit. The model in 
question:

class Story(models.Model):
title = models.CharField(max_length=200)


Regards,
Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group,

Re: Iphone applications via django

2012-09-11 Thread Thomas Weholt
You could use JQuery Mobile on the frontend. It's still a web app like
any other, but app-like in looks and functionality, at least to a
certain degree.

Thomas

On Tue, Sep 11, 2012 at 4:16 PM, Kelly Nicholes  wrote:
> If you go HTML/JS, a phonegap alternative for cross-device compatibility
> would be appcelerator.
>
>
> On Tuesday, September 11, 2012 2:59:12 AM UTC-6, Sait Maraşlıoğlu wrote:
>>
>> How do you create iphone applications via django.
>> Application logic will be django but what about user interface, do we do
>> that with django too?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/M5URL8CILUUJ.
>
> 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.



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Pure python-alternative to Gunicorn/NGINX/Serving static content

2012-08-09 Thread Thomas Weholt
I'm using gunicorn and nginx on ubuntu when deploying my django
projects, but now I need to run a project on several platforms,
including windows. Is there a similar pure python configuration ( with
the expected reduced performance for serving static content )?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Middleware manipulating template in response

2012-08-09 Thread Thomas Weholt
Hmmm ... is there any other way to achieve the same result ( using a
special template for mobile devices ) without hacking this into each
view? MiddleWare using

https://docs.djangoproject.com/en/dev/topics/http/middleware/?from=olddocs/#process-template-response

for instance?

Anyway, thanks for your input.

Thomas

On Thu, Aug 9, 2012 at 3:09 PM, Daniel Roseman  wrote:
>> On Thursday, 9 August 2012 13:18:36 UTC+1, MrMuffin wrote:
>>>
>>> I need to change what template to use in a response based on type of
>>> user-agent in request. The middleware below works ok to detect mobile
>>> client, but I cannot get the template manipulation in the process_view
>>> method  to work.
>>>
>>> The middleware:
>>>
>>> # Credits: http://djangosnippets.org/snippets/2001/
>>> import re
>>>
>>>
>>> class MobileDetectionMiddleware(object):
>>> """
>>> Useful middleware to detect if the user is
>>> on a mobile device.
>>> """
>>>
>>> def process_view(self, request, view_func, view_args, view_kwargs):
>>> if not request.is_mobile:
>>> return
>>>
>>> print vars(view_func), view_args,view_kwargs # these are
>>> allways blank/empty
>>> template = view_kwargs.get("template")
>>> if template is None and view_func.func_defaults:
>>> for default in view_func.func_defaults:
>>> if str(default).endswith(".html"):
>>> template = default
>>> break
>>>
>>> if template is not None:
>>> template = template.rsplit(".html", 1)[0] + ".mobile.html"
>>> try:
>>> get_template(template)
>>> except TemplateDoesNotExist:
>>> return
>>> else:
>>> view_kwargs["template"] = template
>>>
>>> return view_func(request, *view_args, **view_kwargs)
>>>
>>> 
>>>
>>>
>>> from django.shortcuts import *
>>>
>>> def index(request):
>>> return render_to_response('testapp/test.html', {'user':request.user})
>>>
>>>
>>>
>>> Any clues?
>>>
>>>
>>> --
>>> Mvh/Best regards,
>>> Thomas Weholt
>>> http://www.weholt.org
>>
>>
>
> I can't imagine how you are expecting this to work. The template in your
> view is not a parameter, but is hard-coded into the call to
> render_to_response. Your code appears to be wanting to access the default
> value of a non-existent view parameter, modify it, and pass it back into a
> view that isn't expecting it.
>
> It seems like you want to make `template` a parameter to the view, and then
> your middleware could modify that.
> --
> DR.



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Middleware manipulating template in response

2012-08-09 Thread Thomas Weholt
I need to change what template to use in a response based on type of
user-agent in request. The middleware below works ok to detect mobile
client, but I cannot get the template manipulation in the process_view
method  to work.

The middleware:

# Credits: http://djangosnippets.org/snippets/2001/
import re


class MobileDetectionMiddleware(object):
"""
Useful middleware to detect if the user is
on a mobile device.
"""

def process_view(self, request, view_func, view_args, view_kwargs):
if not request.is_mobile:
return

print vars(view_func), view_args,view_kwargs # these are
allways blank/empty
template = view_kwargs.get("template")
if template is None and view_func.func_defaults:
for default in view_func.func_defaults:
if str(default).endswith(".html"):
template = default
break

if template is not None:
template = template.rsplit(".html", 1)[0] + ".mobile.html"
try:
get_template(template)
except TemplateDoesNotExist:
return
else:
view_kwargs["template"] = template

return view_func(request, *view_args, **view_kwargs)

def process_request(self, request):
is_mobile = False

if request.META.has_key('HTTP_USER_AGENT'):
user_agent = request.META['HTTP_USER_AGENT']

# Test common mobile values.
pattern =
"(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|windows
ce|pda|mobile|mini|palm|netfront)"
prog = re.compile(pattern, re.IGNORECASE)
match = prog.search(user_agent)

if match:
is_mobile = True
else:
# Nokia like test for WAP browsers.
#
http://www.developershome.com/wap/xhtmlmp/xhtml_mp_tutorial.asp?page=mimeTypesFileExtension

if request.META.has_key('HTTP_ACCEPT'):
http_accept = request.META['HTTP_ACCEPT']

pattern = "application/vnd\.wap\.xhtml\+xml"
prog = re.compile(pattern, re.IGNORECASE)

match = prog.search(http_accept)

if match:
is_mobile = True

if not is_mobile:
# Now we test the user_agent from a big list.
user_agents_test = ("w3c ", "acs-", "alav", "alca",
"amoi", "audi",
"avan", "benq", "bird", "blac",
"blaz", "brew",
"cell", "cldc", "cmd-", "dang",
"doco", "eric",
"hipt", "inno", "ipaq", "java",
"jigs", "kddi",
"keji", "leno", "lg-c", "lg-d",
"lg-g", "lge-",
"maui", "maxo", "midp", "mits",
"mmef", "mobi",
"mot-", "moto", "mwbp", "nec-",
"newt", "noki",
"xda",  "palm", "pana", "pant",
"phil", "play",
"port", "prox", "qwap", "sage",
"sams", "sany",
"sch-", "sec-", "send", "seri",
"sgh-", "shar",
    "sie-", "siem", "smal", "smar",
"sony", "sph-",
"symb", "t-mo", "teli", "tim-",
"tosh", "tsm-",
"upg1", "upsi", "vk-v", "voda",
"wap-", "wapa",
"wapi", "wapp", "wapr", "webc",
"winw", "winw",
"xda-",)

test = user_agent[0:4].lower()
if test in user_agents_test:
is_mobile = True

request.is_mobile = is_mobile


The view:


from django.shortcuts import *

def index(request):
return render_to_response('testapp/test.html', {'user':request.user})



Any clues?


-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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 render a modeladmin dynamically?

2012-06-22 Thread Thomas Weholt
In a view, I need to get a modeladmin for a model provided
dynamically, change some of the attributes  of the modeladmin ( add an
aggregated field to the queryset, order the queryset by that field and
add a column for that new field in the list_display of the modeladmin
) and render the request using a custom template extending the normal
change_list template. I cannot add these things to the modeladmin of
the models in question, it has to be done at runtime.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Making fields read-only after first save in admin

2012-06-18 Thread Thomas Weholt
I want to make a few foreignkey-fields read-only in the admin after
the post is saved, ie when the change-form for that item is opened
after the item has been saved the two foreignkeys in question should
not be editable. In my case the user has to chose two foreignkeys when
first adding an entry, but those foreignkeys cannot be changed once
the item has been saved. Is that possible?

-- 
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: Import from local ftp server

2012-04-30 Thread Thomas Weholt
Might not be exactly what you need, but want to mention it anyway:

https://bitbucket.org/weholt/djftpd

Regards,
Thomas

On Mon, Apr 30, 2012 at 5:33 PM, orsomannaro  wrote:
> Hi all.
>
> In my LAN I have some files stored in a ftp server, to which I can access
> from my computer with:
>
> ftp://username:password@hostname/path/to/files/*
>
>
> How can I import this files in a Django web-app uploading them directly from
> the ftp server?
>
>
> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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 to Jdango - What IDE to use?

2012-04-23 Thread Thomas Weholt
Me too. I got a open source license for PyCharm for DSE, but it
expires tomorrow and I'm not sure if I have to buy a new developer
license or not. Emailed the Pycharm-boys about this, wondering if I
could extend my open source license but haven't heard anything so far.

Anyhow, PyCharm is great and the guys behind it makes a bunch of great
products.

Thomas

On Mon, Apr 23, 2012 at 2:01 PM, Timothy Makobu
 wrote:
> I have one of those actually, but that's coz I have a project that's been
> around a while. They actually checked out the googlecode page.
>
>
> On Mon, Apr 23, 2012 at 3:00 PM, kenneth gonsalves 
> wrote:
>>
>> On Mon, 2012-04-23 at 14:54 +0300, Timothy Makobu wrote:
>> > If you can spare a few bux, get PyCharm. It's the best.
>>
>> they give open source licenses for free.
>> --
>> regards
>> Kenneth Gonsalves
>>
>> --
>> 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.



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Bulk Creating Django Models from CSV File?

2012-04-02 Thread Thomas Weholt
You might want to look at DSE as well. Currently is has some issues
with Django 1.4, but I'll look into fixing those tonight.

https://bitbucket.org/weholt/dse2

Regards,
Thomas Weholt

On Mon, Apr 2, 2012 at 7:24 AM, Victor Hooi  wrote:
> Hi,
>
> I have several large CSV files that I'm hoping to parse, and use to create
> Django objects. Each line looks might look something like this:
>
>> "Server Hostname", "Classification", "Country", "Operating System"
>>
>> "foo.bar.com", "Prod", "Australia", "Solaris"
>>
>> "alex.john.com", "Dev", "UK", "Linux"
>>
>> "bob.hope.com", "UAT, "Japan", "Windows
>
>
> For performance reasons, it would be nice to use something like 1.4's
> bulk_create:
>
> https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.bulk_create
>
> However, I noticed the caveat about it not populating the auto-incrementing
> PK field. What's the recommended way to populate the PK field then? How do
> you use it?
>
> Secondly, the models will have FK relationships to other models (for
> instance, Classification, Country and Operating System would be stored in a
> lookup table). What's the best way to look these up, and assign the
> appropriate FK, whilst still preserving good performance and using bulk
> inserts?
>
> Cheers,
> Victor
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/bP0RG4NXJjEJ.
> 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.



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Finding It Hard To Make It Work!

2012-02-08 Thread Thomas Weholt
Google "ajax tutorial" or even better just google jquery and take it
from there. There are several tutorials on how to integrate jquery and
django as well.

Thomas

On Wed, Feb 8, 2012 at 10:11 AM, coded kid  wrote:
> How bro? Don't know Ajax. Can you please put me through? I'm a
> Nigerian bro!
>
> On Feb 8, 10:02 am, Babatunde Akinyanmi  wrote:
>> Use AJAX or asynchronous programming
>>
>> On 2/8/12, coded kid  wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> > Hello, I want to make the below codes let users update their status in
>> > the Django . And their update should display on the same template. But
>> > it’s not working.  E.g when a user type in “To be a hacker is not a
>> > day’s job” in the status textarea and click on update button below the
>> > form. The update should display on the same template for his or her
>> > friends to see. Just like how we post status update on fb.
>>
>> > In models.py
>> > from django.contrib.auth.models import User
>> > from django.forms import ModelForm, Textarea, HiddenInput
>> > from django.db import models
>>
>> >     class mob (models.Model):
>> >     username=models.ForeignKey(User, unique=True)
>> >     state_province=models.CharField(max_length=50)
>> >     body=models.TextField(max_length=1)
>> >     date=models.DateTimeField()
>>
>> >     def __unicode__(self):
>> >         return u"%s - %s - %s - %s" % (self.username,
>> > self.state_province, self.body,   self.date)
>>
>> >     def get_absolute_url(self):
>> >         return "/post/%s/" % unicode(self.id)
>> >     def get_author_url(self):
>> >         return "/u/%s/p/0" % (self.username)
>>
>> >     class mobForm(ModelForm):
>> >     class Meta:
>> >         model=mob
>> >         fields=('body','username','state_province','date')
>> >         widgets={
>> >             'body':Textarea(attrs={"rows":2, "cols":40}),
>> >             'username': (HiddenInput),
>> >             'state_province': (HiddenInput),
>> >             'date':(HiddenInput),
>> >         }
>>
>> > In views.py
>> > from myweb.meekapp.models import mobForm, mob
>> > from django.shortcuts import render_to_response
>> > from django.contrib.auth.models import User
>> > from django.http import HttpResponse, Http404
>> > from django.template import RequestContext
>> > from django.http import HttpResponseRedirect
>>
>> >     def homey(request):
>> >  #if there’s nothing in the field do nothing.
>> >     if request. method != "":
>> >         return HttpResponseRedirect('/homi/')
>>
>> >     newmob=mob()
>> >     newmob.username=request.user
>> >     newmob.date=datetime.datetime.now()
>> >     newmob.body=request.POST['body']
>> >     if request.POST['body'] <> '':
>> >         newmob.body=body.objects.get(id=request.POST['body'])
>> >         newmob.save()
>> >         return HttpResponseRedirect('/homi/')
>> >     else:
>> >         return render_to_response('meek_home.html', {'mobForm':
>> > mobForm },context_instance=RequestContext(request))
>>
>> > in template
>>
>> >     {% extends "base_meek.html" %}
>> >           {% block body %}
>> >        
>> >    
>> >      
>> >            {{ mobForm }}
>> >      
>> >      
>> >    
>> >        {% endblock %}
>>
>> > What am I doing wrong? Would love to hear your opinion.
>>
>> > --
>> > 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.
>>
>> --
>> Sent from my mobile device
>
> --
> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Dual license in a django world

2012-01-09 Thread Thomas Weholt
It´s been harder and harder to justify the time spent on my spare time
projects, none of which generate any income. I´m currently working on
a project I believe may have some commercial possebilities and was
wondering if I could try a dual license to generate income. For
personal or non-commercial use there be a BSD or GPL license and some
other license for commercial use ( what license to use ? what to
charge? ). I´m not talking about huge license fees ( $99 for a single
site ?? ) and have no dream about quitting my day-time job any time
soon, but it would be much easier to justify spending time on my
django projects if they generated some kind of income.

What do you think? How would a dual license be recieved in the django
community? Any tip or thought on the subject would be appreciated.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Interface implementation in python

2012-01-04 Thread Thomas Weholt
He probably meant zope.interface :-)

Regards,
Thomas

On Wed, Jan 4, 2012 at 1:47 PM, huseyin yilmaz  wrote:
> Could you direct me to an example (or documentation). I could not find
> any source about zone.interface.
>
> On Jan 4, 2:17 pm, Donald Stufft  wrote:
>> Why not use zone.interface
>>
>>
>>
>>
>>
>>
>>
>> On Wednesday, January 4, 2012 at 7:07 AM, huseyin yilmaz wrote:
>> > Hi everybody,
>>
>> > I want to implement interface functionality in python. I wrote
>> > following sample code
>>
>> >https://gist.github.com/1559689
>>
>> > Here I use an abc as an interface.
>> > Couple of my models are implementing this interface and one of my
>> > consumer model is using those models. In this implementation, I use my
>> > abstract class to check if my models are implementing enough
>> > functionality to make consumer model methods work (use_object method).
>>
>> > Since I used abc's here, I get an error as soon as I try to
>> > instantiate a model object. (I do not need to invoke use_object method
>> > for validation to work.)
>>
>> > Question 1) Is there a better way to implement this validation
>> > functionality.
>> > Question 2) In this implementation, Validation happens at object
>> > instantiation time. Which means If I don't instantiate any object I
>> > won't get any error, Is there a ( short ) way of getting this check on
>> > code initialization? ( I am not dynamicly changing methods of my
>> > 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 
>> > (mailto:django-users@googlegroups.com).
>> > To unsubscribe from this group, send email to 
>> > django-users+unsubscr...@googlegroups.com 
>> > (mailto:django-users+unsubscr...@googlegroups.com).
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Introducing: pythonpackages.com

2012-01-03 Thread Thomas Weholt
Looks nice, allthough one thing that annoys me quite a bit is how
github suddenly becomes the de facto way of logging in everywhere,
like djangopackages.com as well. My old login doesn't work there
anymore. I use bitbucket, and have no plans or need to switch to
github for hosting my projects. Sorry for ranting :-|

Still, like the looks of your project :-) So keep up the good work!

Thomas



On Tue, Jan 3, 2012 at 3:06 AM, Alex Clark  wrote:
> Hi,
>
> For the past two months I've been developing a service for developers and
> consumers of Python packages:
>
> - http://pythonpackages.com
>
> (And as a Django user, this service may be of interest to you).
>
> Recently, we've added the ability for folks to login with their github
> account. This changes the landscape of the site from anonymous to personal,
> and with this change the creation of "profile pages" is now possible, e.g.:
>
> - http://pythonpackages.com/user/nutjob4life
>
> We've seen a fair amount of activity on the site by anonymous users, and
> with this change I envision a fair amount of github user activity. Toward
> that end, I would appreciate it if you would take a minute to login with
> your github account here (requires read only access) and give the service a
> try:
>
> - http://pythonpackages.com/login
>
> You can also browse recent package activity (via the PyPI API) here:
>
> - http://pythonpackages.com/activity
>
> Discuss packages here:
>
> - http://pythonpackages.com/discuss
>
> And read our site documentation here:
>
> - http://pythonpackages-docs.readthedocs.org
>
> Lastly, if you have any feedback please feel free to leave a comment here:
>
> - http://pythonpackages.com/about
>
> Or open a ticket here:
>
> - https://bitbucket.org/pythonpackages/pythonpackages.com/issues/new
>
>
> Thanks,
>
>
> Alex
>
>
> --
> Alex Clark · http://pythonpackages.com
>
> --
> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Which IDE should I use for Django?

2011-12-19 Thread Thomas Weholt
FYI : I got a free time-limited, license for PyCharm using their Open
Source Project License ( apply here
http://www.jetbrains.com/eforms/openSourceRequest.action?licenseRequest=PCOSL
).

Aptana+PyDev seemed heavy and bloated to me. PyCharm is much more
focused on pure python development compared to Aptana which oozes Java
and PyDev is something added on top. As mentioned, I only got a
time-limited license for PyCharm and I'll be looking at other options
if I cannot get my license renewed next year. I might also just by a
license for PyCharm cuz it's really good :-)

Thomas

On Mon, Dec 19, 2011 at 1:47 PM, nicolas HERSOG  wrote:
> I'm using Aptana
>
>
> On Mon, Dec 19, 2011 at 1:37 PM, Anoop Thomas Mathew 
> wrote:
>>
>> Hi,
>>
>> PyCharm is awesome!!! But is paid ($70) and  not OpenSource.
>> Best among the free is Aptana Studio.
>>
>> Thanks,
>> Anoop Thomas Mathew
>>
>> atm
>> ___
>> Life is short, Live it hard.
>>
>>
>>
>>
>>
>> On 19 December 2011 16:41, Thomas Weholt  wrote:
>>>
>>> Pycharm +1
>>>
>>>
>>>
>>> On Mon, Dec 19, 2011 at 11:35 AM, Zhukov Pavel  wrote:
>>> > PyCharm?
>>> >
>>> > On Mon, Dec 19, 2011 at 2:34 PM, Alec Taylor 
>>> > wrote:
>>> >> I'm looking for a Django IDE which incorporates the following
>>> >> features:
>>> >> - Syntax-highlighting
>>> >> - Projects (all code file of the project shown separated by directory
>>> >> in a sidebar)
>>> >> - Tabs (with close buttons on tab)
>>> >> - Code-completion (with good introspection)
>>> >> - Text-zoom support
>>> >> - Start/stop Django server
>>> >> - Run+restart Django server shell (manage.py shell) in project (i.e.
>>> >> below code)
>>> >>
>>> >> I program on Windows and Linux, so it would be great if the IDE is
>>> >> supported on both platforms.
>>> >>
>>> >> Previously I was using Editra, but I requested an automatic import
>>> >> into embedded interpreter feature in April, which they still haven't
>>> >> integrated. So I am looking at alternatives :)
>>> >>
>>> >> Thanks for all suggestions,
>>> >>
>>> >> Alec Taylor
>>> >>
>>> >> --
>>> >> 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.
>>> >
>>>
>>>
>>>
>>> --
>>> Mvh/Best regards,
>>> Thomas Weholt
>>> http://www.weholt.org
>>>
>>> --
>>> 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.
>
>
> --
> 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.



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Which IDE should I use for Django?

2011-12-19 Thread Thomas Weholt
Pycharm +1



On Mon, Dec 19, 2011 at 11:35 AM, Zhukov Pavel  wrote:
> PyCharm?
>
> On Mon, Dec 19, 2011 at 2:34 PM, Alec Taylor  wrote:
>> I'm looking for a Django IDE which incorporates the following features:
>> - Syntax-highlighting
>> - Projects (all code file of the project shown separated by directory
>> in a sidebar)
>> - Tabs (with close buttons on tab)
>> - Code-completion (with good introspection)
>> - Text-zoom support
>> - Start/stop Django server
>> - Run+restart Django server shell (manage.py shell) in project (i.e. below 
>> code)
>>
>> I program on Windows and Linux, so it would be great if the IDE is
>> supported on both platforms.
>>
>> Previously I was using Editra, but I requested an automatic import
>> into embedded interpreter feature in April, which they still haven't
>> integrated. So I am looking at alternatives :)
>>
>> Thanks for all suggestions,
>>
>> Alec Taylor
>>
>> --
>> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Bulk import of data

2011-12-04 Thread Thomas Weholt
I think it's been mentioned before in this thread, but DSE was made to
help solve problems this. The other solutions I've seen for this
problem, like the one mentioned by Karen, lack several of DSE's
features, like handling of default values defined in your model.

https://bitbucket.org/weholt/dse2

And yes, I'm the author of DSE ;-)

Regards,
Thomas


On Sun, Dec 4, 2011 at 3:53 AM, Karen Tracey  wrote:
> On Sat, Dec 3, 2011 at 9:37 PM, Nathan McCorkle  wrote:
>>
>> when you say 'as long as you don't use the ORM for inserts',
>
>
> You do not want to be building and saving objects individually with the ORM.
> You want to be using some form of bulk insert. Django 1.4 will add bulk
> create capability (see
> https://docs.djangoproject.com/en/dev/ref/models/querysets/#bulk-create).
> Prior to 1.4 you can use the development trunk level code, or you can find
> other libraries that provide bulk insert (see for example
> http://ole-laursen.blogspot.com/2010/11/bulk-inserting-django-objects.html).
> http://www.caktusgroup.com/blog/2011/09/20/bulk-inserts-django/ mentions the
> kinds of speedups you can expect with using a bulk insert technique vs.
> creating objects individually with the ORM.
>
> Karen
> --
> http://tracey.org/kmt/
>
>
> --
> 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.



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Looking for a job in the Arctic Circle

2011-09-30 Thread Thomas Weholt
Ok, this is of-topic, but why immigrate from The Netherlands and why
for the Love of All that's Holy would you move to the coldest place on
earth? I live in Norway and just don't understand this. And sorry, I
am aware this is not django related.

Thomas

On Fri, Sep 30, 2011 at 2:55 PM, Kevin Renskers  wrote:
> Finding a position in The Netherlands would be SUPER easy. The problem is
> that I want to immigrate to another country :) Remote working from The
> Netherlands is not what I am looking for.
>
>
> On Friday, September 30, 2011 2:51:28 PM UTC+2, SleepyCal wrote:
>>
>> Hmm - CCP would have been a very good company to get in with :/
>> I'm surprised you have not found any other decent positions in Nederland
>> tbh.
>> BoxedIce (owners of ServerDensity) are always on the look out for new
>> developers, they offer remote working, and they already have staff in
>> Nederland.
>> Hope this helps.
>> Cal
>>
>> On Fri, Sep 30, 2011 at 1:47 PM, Kevin Renskers  wrote:
>>>
>>> CCP actually wanted me for their UI Programmer position. Did the first
>>> round of interviews, made a usability report for them, all was well. And
>>> then they decided that they don't really need a UI Programmer after all :(
>>> Their other positions are not really a great match for me, sadly. Too
>>> much C++, DirectX, GPU stuff, etc.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/django-users/-/1PqrbM7SjkoJ.
>>> To post to this group, send email to django...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users...@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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/_OtQN-CLLLEJ.
> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Caching static images using memcache/nginx

2011-09-15 Thread Thomas Weholt
Aha! That's briliant, but doesn't nginx set those headers for me when
returning a static resource like a image?

Thomas

On Thu, Sep 15, 2011 at 4:52 PM, Ilian Iliev  wrote:
> How about to set correct headers and make the images cached on user side
> instead
> of wasting memchached resources?
> If you are serving tons of thumbs multiple times I bet that the traffic will
> be bigger problem
> than the time it took for these images to be read from disk.
>
> Check this post ->
> http://ilian.i-n-i.org/caching-web-sites-and-web-applications/ there you
> can see which headers you need to set to tell the client browser to cache a
> resource.
>
>
> On Thu, Sep 15, 2011 at 4:51 PM, Thomas Weholt 
> wrote:
>>
>> Good point Cliff! I just assumed serving static content would benefit
>> from caching, but perhaps my effort is more well spent focusing on
>> other aspects of my app right now.
>>
>> Thanks :-)
>>
>> Thomas
>>
>>
>> On Thu, Sep 15, 2011 at 3:42 PM, J. Cliff Dyer 
>> wrote:
>> > What is your goal in doing this?  You are unlikely to see any
>> > performance gains from this effort.
>> >
>> > It won't render any faster for your users.  Sending bytes over the
>> > network is far slower than reading them off disk, so it's not likely to
>> > be a bottleneck in terms of page loading.
>> >
>> > Your filesystem is likely caching commonly read items for you already.
>> > Trying to outsmart this system is likely to just waste memory and slow
>> > things down by caching the wrong things.
>> >
>> > Have you determined that this is actually a bottleneck in your app?  It
>> > seems unlikely that serving static thumbnails is actually the thing
>> > slowing your app down.
>> >
>> > Cheers,
>> > Cliff
>> >
>> >
>> > On Thu, 2011-09-15 at 15:24 +0200, Thomas Weholt wrote:
>> >> Ok, this might sound a bit off-topic but bear with me.
>> >>
>> >> I got a templatetag in an app that generates thumbnails (
>> >> django-photofile ). In my templates it might look like this
>> >>
>> >> 
>> >>
>> >> It will generate a thumbnail of the photo in 100x100 in a folder
>> >> served by nginx for all static content and return an url pointing to
>> >> the thumbnail, for instance
>> >> '/static/thumb/4432lkj432kl5k4l26k_100x100.jpg'.
>> >>
>> >> This all works nice and dandy, but I want to cache the static photos
>> >> using memcache, so that when the page is rendered and the templatetag
>> >> returns the url '/static/thumb/4432lkj432kl5k4l26k_100x100.jpg'
>> >> nginx will look for it on disk, cache it using memcache and return it
>> >> so that the next time the page is rendrered it will be read from the
>> >> cache and not from disk.
>> >>
>> >> I got a folder served by nginx with all my static content (js, css,
>> >> images ), including the thumbnails and I want to cache it all ( using
>> >> the assigned amount of ram to memcache of course, but I hope this is
>> >> handled by memcache ).
>> >>
>> >> I've read through a few articles about nginx, memcache etc, but still
>> >> haven't a clue on how to do this.
>> >>
>> >> NB! The reason I think/hope this is on topic is the fact I use a
>> >> templatetag to generate the url etc. Sorry if it's still of topic.
>> >>
>> >> --
>> >> Mvh/Best regards,
>> >> Thomas Weholt
>> >> http://www.weholt.org
>> >>
>> >
>> >
>> > --
>> > 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.
>> >
>> >
>>
>>
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>> --
>> 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.

Re: Caching static images using memcache/nginx

2011-09-15 Thread Thomas Weholt
Good point Cliff! I just assumed serving static content would benefit
from caching, but perhaps my effort is more well spent focusing on
other aspects of my app right now.

Thanks :-)

Thomas


On Thu, Sep 15, 2011 at 3:42 PM, J. Cliff Dyer  wrote:
> What is your goal in doing this?  You are unlikely to see any
> performance gains from this effort.
>
> It won't render any faster for your users.  Sending bytes over the
> network is far slower than reading them off disk, so it's not likely to
> be a bottleneck in terms of page loading.
>
> Your filesystem is likely caching commonly read items for you already.
> Trying to outsmart this system is likely to just waste memory and slow
> things down by caching the wrong things.
>
> Have you determined that this is actually a bottleneck in your app?  It
> seems unlikely that serving static thumbnails is actually the thing
> slowing your app down.
>
> Cheers,
> Cliff
>
>
> On Thu, 2011-09-15 at 15:24 +0200, Thomas Weholt wrote:
>> Ok, this might sound a bit off-topic but bear with me.
>>
>> I got a templatetag in an app that generates thumbnails (
>> django-photofile ). In my templates it might look like this
>>
>> 
>>
>> It will generate a thumbnail of the photo in 100x100 in a folder
>> served by nginx for all static content and return an url pointing to
>> the thumbnail, for instance
>> '/static/thumb/4432lkj432kl5k4l26k_100x100.jpg'.
>>
>> This all works nice and dandy, but I want to cache the static photos
>> using memcache, so that when the page is rendered and the templatetag
>> returns the url '/static/thumb/4432lkj432kl5k4l26k_100x100.jpg'
>> nginx will look for it on disk, cache it using memcache and return it
>> so that the next time the page is rendrered it will be read from the
>> cache and not from disk.
>>
>> I got a folder served by nginx with all my static content (js, css,
>> images ), including the thumbnails and I want to cache it all ( using
>> the assigned amount of ram to memcache of course, but I hope this is
>> handled by memcache ).
>>
>> I've read through a few articles about nginx, memcache etc, but still
>> haven't a clue on how to do this.
>>
>> NB! The reason I think/hope this is on topic is the fact I use a
>> templatetag to generate the url etc. Sorry if it's still of topic.
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>
>
> --
> 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.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Caching static images using memcache/nginx

2011-09-15 Thread Thomas Weholt
Ok, this might sound a bit off-topic but bear with me.

I got a templatetag in an app that generates thumbnails (
django-photofile ). In my templates it might look like this



It will generate a thumbnail of the photo in 100x100 in a folder
served by nginx for all static content and return an url pointing to
the thumbnail, for instance
'/static/thumb/4432lkj432kl5k4l26k_100x100.jpg'.

This all works nice and dandy, but I want to cache the static photos
using memcache, so that when the page is rendered and the templatetag
returns the url '/static/thumb/4432lkj432kl5k4l26k_100x100.jpg'
nginx will look for it on disk, cache it using memcache and return it
so that the next time the page is rendrered it will be read from the
cache and not from disk.

I got a folder served by nginx with all my static content (js, css,
images ), including the thumbnails and I want to cache it all ( using
the assigned amount of ram to memcache of course, but I hope this is
handled by memcache ).

I've read through a few articles about nginx, memcache etc, but still
haven't a clue on how to do this.

NB! The reason I think/hope this is on topic is the fact I use a
templatetag to generate the url etc. Sorry if it's still of topic.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Using gedit for django development

2011-09-13 Thread Thomas Weholt
Very nice. Did some work on making a plug-in for the Editra editor
with the same goal but your project looks much better, Thanks!

Thomas

On Tue, Sep 13, 2011 at 2:12 AM, Micah Carrick  wrote:
> I've written a blog post on using gedit, the default text editor in GNOME,
> as a Django IDE. If you're a Linux user and you've never considered using
> gedit for development then this may be an interesting read for you.
> http://www.micahcarrick.com/gedit-as-a-django-ide-for-linux.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-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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Norwegian Sorting

2011-09-09 Thread Thomas Weholt
As a norwegian myself this is very interesting. I have no clue how to
help you, but please post information about any solution you might
encounter on your quest.

Regards,
Thomas

On Fri, Sep 9, 2011 at 11:18 PM, Tim Sawyer  wrote:
> Hi Folks,
>
> I have a django site which is against a postgres database which is UTF8.  I
> have a large droplist with international names in, and it doesn't appear to
> be sorting correctly.
>
> The list contains Ingvar Mæland and Børre Børresen.  I'm told that the
> Norwegian sort order should be X Y Z Æ Ø Å.  That's not what I'm seeing - I
> think it's just sorting them as A's.
>
> I found Ingvar Mæland in the place I would expect to find Maland
>
> I found Børre Børresen in the place I would expect to find Barresen
>
> LANGUAGE_CODE = 'en-gb', in settings.py.
>
> Does anyone know what I've missed?
>
> Thanks,
>
> Tim.
>
> --
> 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.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Values for ManyToMany-field set in code not visible in admin

2011-08-29 Thread Thomas Weholt
I got a model with a ManyToMany-field which is set/populated when
saved based on other fields. It can be set in the admin as well. When
this field is set in code, and I can see the correct values have been
set when getting the object from the database, the correct values in
the ManyToMany-field in the change_form for the model are not
selected. Selected the values for the ManyToMany-field in the admin
manually is saved ok and display ok. What's the difference between
setting fields like this in code and doing it in the admin?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Where's the code picking apart the info about selected filters in the admin change_list stored in the current session?

2011-08-28 Thread Thomas Weholt
Is this just spam/phising or what?

Thomas

On Sun, Aug 28, 2011 at 6:44 PM,  wrote:

> I am out of office right now and will get back to you when I return. If you
> don't hear from me, my assistant should contact you shortly. Check out this
> massage chair that I just bought to help relax me after work!.Click 
> Here<http://click22.googlegroups.com/cl/click.php?un=cHVsbHFOZA&subid=googlegroups&noimg=1&encSearch=X3t7dmN2ZDdaYXBhdmc>
>
> Enable images or click 
> here<http://click22.googlegroups.com/cl/click.php?un=cHVsbHFOZA&subid=googlegroups&noimg=1&encSearch=X3t7dmN2ZDdaYXBhdmc>
>
> <http://click22.googlegroups.com/cl/click.php?un=cHVsbHFOZA&subid=googlegroups&oc=1>
> Let me know what you think after you have a chance to review.
> Cheers!
>
> If you no lon ger wish to receive emails, please 
> unsubscribe<http://click22.googlegroups.com/cl/unsubscribe.php>
>
> 866-288-1880
> 5150 yarmouth ave, Encino, CA 91316
> On Sun, 28 Aug 2011 18:43:54 +0200, Thomas Weholt ** wrote:
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Where's the code picking apart the info about selected filters in the admin change_list stored in the current session?

2011-08-28 Thread Thomas Weholt
Where's the code picking apart the info about selected filters stored
in the current session? I see from the source that setting filters in
the admin change_list are stored in the session, but I cannot find the
code picking the session data apart and building a queryset. Do you
have any tips? I want to create a similar piece of code as an
alternative change_list in the admin.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Creating an alternative change_list view for a specific app/model, not extending or overriding

2011-08-25 Thread Thomas Weholt
That might work, but I was hoping the change_list was a generic class
based view I could subclass and use in my own urls.py for my app, but
looking into the source
(site-packages\django-1.3-py2.7.egg\django\contrib\admin\views\main.py)
of the admin it's not clear at all about how to approach it.

Any clues on how to subclass the admin views?

Thomas

On Thu, Aug 25, 2011 at 2:31 AM, Thomas Orozco
 wrote:
> What about calling your admin view with a GET "alternate=1" parameter ?
>
> An if statement in a template override would then allow you to render
> properly depending on the aforementioned attribute provided you're passing
> the request in the Context.
>
> This event allows you to fine tune which bits you want to change.
>
> Le 24 août 2011 23:38, "Thomas Weholt"  a écrit :
>> I want to create a view looking and working just like the admin
>> change_list, but using my own template ( based on the admin
>> change_list template ) so that all the filtering you get from
>> specifiying filtering in your adminmodel still works in my new view. I
>> DO NOT want to extend or override the existing one but provide an
>> additional/alternative view to the existing change_list for a specific
>> app/model. I need to change how the elements in the change_list are
>> presented. I'm listing photos, and want a layout like googles image
>> search, not the table-based you get by default in the admin. I need to
>> do this as well in my alternative view. I want to use the
>> date-hierarchy, filtering, pagination, admin actions etc you get for
>> free in the admin in my alternative view.
>>
>> Is this possible? How do I reuse most of the existing admin code to
>> achieve this?
>>
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>> --
>> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Creating an alternative change_list view for a specific app/model, not extending or overriding

2011-08-24 Thread Thomas Weholt
I want to create a view looking and working just like the admin
change_list, but using my own template ( based on the admin
change_list template ) so that all the filtering you get from
specifiying filtering in your adminmodel still works in my new view. I
DO NOT want to extend or override the existing one but provide an
additional/alternative view to the existing change_list for a specific
app/model. I need to change how the elements in the change_list are
presented. I'm listing photos, and want a layout like googles image
search, not the table-based you get by default in the admin. I need to
do this as well in my alternative view. I want to use the
date-hierarchy, filtering, pagination, admin actions etc you get for
free in the admin in my alternative view.

Is this possible? How do I reuse most of the existing admin code to
achieve this?


-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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 django be used in destop application?

2011-08-24 Thread Thomas Weholt
I remember "way back in the day" when Userland was paving way for what
was to become xml-rpc, feeds etc ( if I remeber correcly ), the core
was a web application running at localhost only. Worked great! I like
the idea and allready have a project for something like this. I've
tried wxpython, pyqt etc and I still make stuff way faster using
django. It doesn't fit every project though.

And another thing; there have been discussion about how to distribute
django projects and a django project distributed as a single binary, a
setup.exe on windows for instance? Sounds nice.

Thomas

On Wed, Aug 24, 2011 at 11:18 AM, Gelonida N  wrote:
>> Curious concept, using Django for a desktop application.
>>
>> Can't think of any reason why you couldn't at least try it :)
>>
>> Cal
>>
>>
> Original poster was rather clear I think,
>
>>     > it seems its orm can be used in destop application, isn't it?
>
>
> It could make sense to use Django orms, because one knows already django
> orms, but one doesn't know SqlAlchemy or any other orms.
>
> This use case is possible, but not that nicely supported.
> you.
>
>
> You can also search for the thread
> "import django models without runing the server",
>
> which would also be applicable for desktop applications using
> django orms
>
>
> On 08/23/2011 07:36 PM, Cal Leeming [Simplicity Media Ltd] wrote:
>
> --
> 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.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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 user - Trouble starting

2011-08-15 Thread Thomas Weholt
Have you tried this in the command window ( assuming python is
installed in c:\python27 ):

c:\python27\python c:\python27\scripts\django-admin.py startproject mysite

On windows you might need to run python scripts through python like
shown above. And add c:\python27; c:\python27\scripts; to your path.

The other question, about os.chdir; you'll have to import os before
calling methods defined in it, like so :

c:\python27\python
>>> import os
>>> os.chdir('c:\temp')

Hope this helps :-)

PS! It seems like your new to python as well. I strongly recommend you
dive into python first before getting into django.

Thomas

On Mon, Aug 15, 2011 at 11:54 PM, squirrel  wrote:
> I'm trying to start the tutorial (on Windows by the way) and I can't
> get anywhere. When I enter "django-admin.py startproject mysite" into
> either the interpreter or the Python command line I get the same
> message:
> Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit
> (Intel)] on win32
> Type "copyright", "credits" or "license()" for more information.
>>>> import django
>>>> django-admin.py startproject mysite
>                                               ^
> SyntaxError: invalid syntax
>>>>
>
> I've already made sure "C:\Python27\Lib\site-packages\django\bin" is
> set to my system path settings, and django-admin.py is in bin.
>
> What am I doing wrong?
>
> Also, I haven't been able to cd. I've tried os.chdir(), but it says
> 'os' is not defined. In the Python docs it says that's supposed to
> work on Windows machines, so is that not the right function for what
> I'm trying to do?
>
> --
> 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.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Using {% url somenamedview %} in a custom page extending admin templates

2011-08-15 Thread Thomas Weholt
My urls.py for my app:

urlpatterns = patterns('',
url(r'^geocoding/$', geocoding, name='geocoding'),
)

I've extended the change_list.html template based on the standard
change_list.html and added this piece :

{% block content %}
  
{% block object-tools %}
  {% if has_add_permission %}


  From geocoding


where {% url geocoding %} is the problem. When rendered it says:

TemplateSyntaxError at /admin/locationbase/location/
Caught NoReverseMatch while rendering: Reverse for '' with arguments
'()' and keyword arguments '{}' not found.

So the question is; how can I use the url template tag in templates
extending the standard admin templates and refer to a view defined in
my app by name?

What am I now seeing here?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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-Registration, How can a beginner work with this 3rd party App?

2011-08-15 Thread Thomas Weholt
Have you followed the standard tutorial on
https://docs.djangoproject.com/en/1.3/intro/tutorial01/? Look at the
http://www.djangobook.com/en/2.0/ ? If you haven't you should start
there and not jump directly at a third app. After doing the tutorials
and reading through the djangobook the online documentation of
third-party apps won't be so cryptic.

Thomas

On Mon, Aug 15, 2011 at 8:38 PM, Andre Lopes  wrote:
> Hi, another question from a beginner.
>
> I am getting some trouble to get Django-Registration working. The
> on-line 
> documentation(http://readthedocs.org/docs/django-registration/en/latest/)
> is not for a beginner like me, there are many steps that I don't know
> how to do them. For example the creation of the templates (login.html,
> registration_form.html, etc) I have must to search them on Goggle, and
> I found out examples on how to do this templates
> (http://www.lightbird.net/dbe/forum3.html).
>
> My question is, there are any tutorial on Django-Registration that
> will help a beginner like me to get this wonderful App working?
>
> Best Regards,
>
> --
> 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.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: 3rd party Apps in Django

2011-08-15 Thread Thomas Weholt
Hmmm...

Using pip will take care of requirements the package might have and
install it in the right python lib folder so several projects can use
it among other things.

Are there good reasons NOT to use pip/easy_install or at least python
setup.py install?

Thomas



On Mon, Aug 15, 2011 at 2:59 PM, Andre Lopes  wrote:
> Hi, I have put this question in StackOverflow, but no response untill
> now... This is an important question to me to understand how Django
> works
>
> I am new to Django.
>
> I have some doubts about installing 3rd party Apps in Django.
>
> A specific example. The "django-registration" App in
> https://bitbucket.org/ubernostrum/django-registration/src. Reading the
> instructions the doc tell us to install this app with PIP(pip install
> django-registration), doing this the App will be installed in Python
> Site-packages, right?
>
> My question is: The App must to be installed in that way? Why not put
> the 'django-registration' folder in our Project as an App?
>
> PS: This is a starter Django Question.
>
> Best Regards,
>
> --
> 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.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: "Great circle" using the django ORM?

2011-08-12 Thread Thomas Weholt
Ok, now I've created an open project at bitbucket with a public issue
tracker so put any of your ideas/comments/bugs there.

https://bitbucket.org/weholt/django-locationbase

As mentioned I'll look more into this during this weekend and release
something next week if I get it working properly. The current
implementation doesn't rely on heavy math operations and seems to be
database agnostic, only using the orm. This is old code and worked
using sqlite. Not sure how well it plays against postgres or mysql.

Thanks for your attention once again.

Thomas



On Fri, Aug 12, 2011 at 12:28 PM, Thomas Weholt  wrote:
> Hi all,
>
> This is what I've come up with so far. Not tested, but I came across
> an old piece of code doing the same thing ( I knew I'd done it before,
> just had to look deep into my code archives ;-) ):
>
> http://dpaste.com/592639/
>
> Comments very welcome. Expect a pypi-release some time after the
> weekend. Perhaps there's more things features we could add too, like
> google maps integration, some form of widget to use in the admin etc.
> Feel free to steal the code or suggest ideas.
>
> Thomas
>
> On Fri, Aug 12, 2011 at 10:33 AM, Mike Dewhirst  wrote:
>> Thomas
>>
>> Don't know if this helps but one degree of latitude is sixty nautical miles
>> at the equator and slightly less at the poles. Not worth worrying about.
>>
>> OTOH, one degree of longitude shrinks from 60 NM at the equator to zero at
>> the poles - which might help you visualize the necessary math.
>>
>> I bet Google has worked all this out before..
>>
>> Good luck - and I'm interested in the result.
>>
>> Mike
>>
>> On 12/08/2011 5:51pm, Thomas Weholt wrote:
>>>
>>> Thanks for your detailed reply :-) I'll try to figure it out. So far I
>>> got a few candidates for a solution but the math functions seem to be
>>> somewhat different on the different database platforms so I need to
>>> experiment some more to find one that works on the three major ones (
>>> sqlite, postgres and mysql - I often use sqlite for development and
>>> postgres for production myself, but still want to support mysql ).
>>>
>>> About the accuracy; my app is suppose to show photos take nearby some
>>> location so it doesn't have to be dead on. But this should really be a
>>> reusable app or widget. Seems like more than just me needs this
>>> functionality. If I get something going I'll look into making it
>>> generic and reusable. Anybody interesting in helping out making this
>>> happen please let me know. My experience using math functions in SQL
>>> like this is close to zero.
>>>
>>> Thanks alot for all the replies and interest :-)
>>>
>>> Regards,
>>> Thomas
>>>
>>> On Thu, Aug 11, 2011 at 7:51 PM, Bill Freeman  wrote:
>>>>
>>>> I've done this sort of thing in the past without the aid of geo-django,
>>>> using a
>>>> reasonably ordinary model.
>>>>
>>>> I did it as a two step process, first calculating a bounding box, which
>>>> is a
>>>> rectangle in lat/long space.  It is calculated once per search, based on
>>>> the distance and the coordinates of the distance circle's center (the
>>>> point
>>>> from which you are measuring distance).
>>>>
>>>> A pair of latitudes that are tangent to the distance circle are easy to
>>>> come
>>>> by because the point of tangency is at the same longitude as the circle's
>>>> center, and because distance in linear with latitude along such a line.
>>>>
>>>> Bounding longitudes are harder because their points of tangency are
>>>> closer to the pole than the circle's center (unless it's on the equator),
>>>> as well as distance not being linear with longitude change.  But since
>>>> a distance circle radius through the point of tangency will necessarily
>>>> intersect the bounding line of longitude at a right angle, you can use
>>>> one of the spherical right triangle formulas.  I like:
>>>>   sin(a) = sin(A) * sin(c)
>>>> where the triangle includes the pole, the point of tangency, and the
>>>> center
>>>> of the distance circle; "a" is the angle, measured as seen from the
>>>> center
>>>> of the earth, subtended by the side not involving the pole, that is of
>>>> the
>>>> distance radius (2*PI*distance/earth_radius); "c&q

Re: "Great circle" using the django ORM?

2011-08-12 Thread Thomas Weholt
Hi all,

This is what I've come up with so far. Not tested, but I came across
an old piece of code doing the same thing ( I knew I'd done it before,
just had to look deep into my code archives ;-) ):

http://dpaste.com/592639/

Comments very welcome. Expect a pypi-release some time after the
weekend. Perhaps there's more things features we could add too, like
google maps integration, some form of widget to use in the admin etc.
Feel free to steal the code or suggest ideas.

Thomas

On Fri, Aug 12, 2011 at 10:33 AM, Mike Dewhirst  wrote:
> Thomas
>
> Don't know if this helps but one degree of latitude is sixty nautical miles
> at the equator and slightly less at the poles. Not worth worrying about.
>
> OTOH, one degree of longitude shrinks from 60 NM at the equator to zero at
> the poles - which might help you visualize the necessary math.
>
> I bet Google has worked all this out before..
>
> Good luck - and I'm interested in the result.
>
> Mike
>
> On 12/08/2011 5:51pm, Thomas Weholt wrote:
>>
>> Thanks for your detailed reply :-) I'll try to figure it out. So far I
>> got a few candidates for a solution but the math functions seem to be
>> somewhat different on the different database platforms so I need to
>> experiment some more to find one that works on the three major ones (
>> sqlite, postgres and mysql - I often use sqlite for development and
>> postgres for production myself, but still want to support mysql ).
>>
>> About the accuracy; my app is suppose to show photos take nearby some
>> location so it doesn't have to be dead on. But this should really be a
>> reusable app or widget. Seems like more than just me needs this
>> functionality. If I get something going I'll look into making it
>> generic and reusable. Anybody interesting in helping out making this
>> happen please let me know. My experience using math functions in SQL
>> like this is close to zero.
>>
>> Thanks alot for all the replies and interest :-)
>>
>> Regards,
>> Thomas
>>
>> On Thu, Aug 11, 2011 at 7:51 PM, Bill Freeman  wrote:
>>>
>>> I've done this sort of thing in the past without the aid of geo-django,
>>> using a
>>> reasonably ordinary model.
>>>
>>> I did it as a two step process, first calculating a bounding box, which
>>> is a
>>> rectangle in lat/long space.  It is calculated once per search, based on
>>> the distance and the coordinates of the distance circle's center (the
>>> point
>>> from which you are measuring distance).
>>>
>>> A pair of latitudes that are tangent to the distance circle are easy to
>>> come
>>> by because the point of tangency is at the same longitude as the circle's
>>> center, and because distance in linear with latitude along such a line.
>>>
>>> Bounding longitudes are harder because their points of tangency are
>>> closer to the pole than the circle's center (unless it's on the equator),
>>> as well as distance not being linear with longitude change.  But since
>>> a distance circle radius through the point of tangency will necessarily
>>> intersect the bounding line of longitude at a right angle, you can use
>>> one of the spherical right triangle formulas.  I like:
>>>   sin(a) = sin(A) * sin(c)
>>> where the triangle includes the pole, the point of tangency, and the
>>> center
>>> of the distance circle; "a" is the angle, measured as seen from the
>>> center
>>> of the earth, subtended by the side not involving the pole, that is of
>>> the
>>> distance radius (2*PI*distance/earth_radius); "c", the hypontenuse, is
>>> the same thing for the distance between the distance circle's center and
>>> the pole, that is, the compliment of the latitude of the distance
>>> circle's
>>> center; and A is the surface angle subtended at the pole, that is, the
>>> difference in longitude (what we're looking for).  Because it would be
>>> convenient to work in latitude, rather than compliment of latitude,
>>> change
>>> the formula to:
>>>  sin(a) = sin(A) * cos(lat)
>>> therefore:
>>>  A = asin(sin(a)/cos(lat))
>>> The desired bounding longitudes are then +/- A from the longitude of
>>> the distance circle's center's longitude.  It doesn't hurt that the use
>>> of cos(lat) has even symmetry, making it clear that you don't have to
>>> choose a pole.
>>>
>>> Now you select candidate datab

Re: "Great circle" using the django ORM?

2011-08-12 Thread Thomas Weholt
(which is as far as you can get on the globe), acos(x) is, while not
> linear, monotonic(ly decreasing) with x.  So throwing out the candidates
> that are in the corners of the bounding box can be done using the
> the expression inside the acos, by comparing it to:
>  a = cos(d/(2*PI*earth_radius))
> and discarding points where:
>  a < sin_lat1*sin_lat2 + cos_lat1*cos_lat2*cos(long1 - long2)
> taking us down to one trig operation for those.  (Yes, I have the inequality
> correct: cos == 1 implies 0 distance, and cos gets smaller as you get
> further until you are as far away as possible, on the other side of the 
> globe.)
>
> Note that you can even sort by the cos of the distance angle (the thing
>
> And, yes, "a" is the "a" from the bounding box calculation, so you only have
> to calculate it once per look up.  In fact, if you only offer a limited set of
> distances, you can calculate "a" for each of them once, at startup.
> being compared to "a"), largest first to get smallest distance first.
>
> Most databases will support such expressions, so if you are willing to
> execute SQL directly (https://docs.djangoproject.com/en/1.3/topics/db/sql/)
> you can get the database to calculate the cos of the distance angle, do the
> compare on it, and also sort by it.  The trick is to avoid doing the 
> calculation
> for points outside the bounding box, and you will have to know your database
> well to do that (a stored procedure may be in order).  You also don't want
> to sort before you've winnowed, so there may be a sub-query (or so) involved.
>
> You might even be able to do it using the "raw" model manager method, though
> having calculated the cos of the distance angle, and assuming that you will
> want to display the distance to each candidate, you would like to have it
> returned, and it's not a model field.
>
> Python should be just as fast as the database on the trig, but decreasing the
> number of items that get passed over the database connection, and that then
> must be instantiated as model instances in django, is a performace benefit.
>
> Good luck.
>
> On Thu, Aug 11, 2011 at 11:09 AM, Thomas Weholt  
> wrote:
>> I got a model with longitude and latitude and want to be able to find
>> other objects nearby a selected object. Can this be done using the
>> django orm? What is the best approach to do this in a django project?
>>
>> I found a answer on Stackoverflow, but doesn't work with sqlite. Doing
>> it in SQL is ok and probably the best solution performance wise, but
>> if it has to be done in python I'll do that too.
>>
>> Ref question on stackoverflow:
>> http://stackoverflow.com/questions/4610717/django-determining-if-geographic-coordinates-are-inside-of-an-circle
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>> --
>> 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.
>>
>>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



"Great circle" using the django ORM?

2011-08-11 Thread Thomas Weholt
I got a model with longitude and latitude and want to be able to find
other objects nearby a selected object. Can this be done using the
django orm? What is the best approach to do this in a django project?

I found a answer on Stackoverflow, but doesn't work with sqlite. Doing
it in SQL is ok and probably the best solution performance wise, but
if it has to be done in python I'll do that too.

Ref question on stackoverflow:
http://stackoverflow.com/questions/4610717/django-determining-if-geographic-coordinates-are-inside-of-an-circle

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Keep filtering from change_list in admin in custom page?

2011-08-10 Thread Thomas Weholt
On Wed, Aug 10, 2011 at 11:56 AM, Subhranath Chunder
 wrote:
> You can either override a particular, or give a completely alternative
> change_list page.
> For your case, overriding seems to be a better option to me
> https://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates

E ... I do not want to override. To be precise I want a
button/link beside the "Add " in the change_list which,
when clicked, opens a new page, extending the base-admin template,
taking the current filters used in the change_list and displays the
same data in a different layout, using a different template. Perhaps
I'm not understanding what you're saying, but I need the standard
change_list as well as the alternative one.

But thanks for your help. I see you're very active on the list today.
Very good :-)

Thomas


> If you are going for new change_list template
> https://docs.djangoproject.com/en/dev/ref/contrib/admin/#custom-template-options
>
> On Wed, Aug 10, 2011 at 2:49 PM, Thomas Weholt 
> wrote:
>>
>> Hmmm ... Not sure how to do that. You could say I want an alternative
>> change_list page, but not by overriding or extending the existing
>> default one.
>>
>> Do you know of any example or documentation on how to achive this?
>>
>> Anyway, thanks for your input :-)
>>
>> Regards,
>> Thomas
>>
>> On Wed, Aug 10, 2011 at 11:07 AM, Subhranath Chunder
>>  wrote:
>> > Yes, you can do that. You would have to override the default
>> > change_view_template. And if required, then probably the
>> > changelist_view()
>> > too.
>> >
>> > On Wed, Aug 10, 2011 at 2:28 PM, Thomas Weholt 
>> > wrote:
>> >>
>> >> Is it possible to keep the filtering done in an admin change_list in a
>> >> custom page? For instance, I got a app showing photos where you can
>> >> filter on camera, width, height, exif-date, iso speed, exposure etc
>> >> and the admin makes filtering my data very easy using a custom
>> >> AdminModel. My filter shows up on the right side of the page. But I
>> >> want to have a custom page for displaying the actual photos using the
>> >> same filter set in the change_list page. Is this possible?
>> >>
>> >> --
>> >> Mvh/Best regards,
>> >> Thomas Weholt
>> >> http://www.weholt.org
>> >>
>> >> --
>> >> 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.
>> >
>>
>>
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>> --
>> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Keep filtering from change_list in admin in custom page?

2011-08-10 Thread Thomas Weholt
Hmmm ... Not sure how to do that. You could say I want an alternative
change_list page, but not by overriding or extending the existing
default one.

Do you know of any example or documentation on how to achive this?

Anyway, thanks for your input :-)

Regards,
Thomas

On Wed, Aug 10, 2011 at 11:07 AM, Subhranath Chunder
 wrote:
> Yes, you can do that. You would have to override the default
> change_view_template. And if required, then probably the changelist_view()
> too.
>
> On Wed, Aug 10, 2011 at 2:28 PM, Thomas Weholt 
> wrote:
>>
>> Is it possible to keep the filtering done in an admin change_list in a
>> custom page? For instance, I got a app showing photos where you can
>> filter on camera, width, height, exif-date, iso speed, exposure etc
>> and the admin makes filtering my data very easy using a custom
>> AdminModel. My filter shows up on the right side of the page. But I
>> want to have a custom page for displaying the actual photos using the
>> same filter set in the change_list page. Is this possible?
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>> --
>> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Keep filtering from change_list in admin in custom page?

2011-08-10 Thread Thomas Weholt
Is it possible to keep the filtering done in an admin change_list in a
custom page? For instance, I got a app showing photos where you can
filter on camera, width, height, exif-date, iso speed, exposure etc
and the admin makes filtering my data very easy using a custom
AdminModel. My filter shows up on the right side of the page. But I
want to have a custom page for displaying the actual photos using the
same filter set in the change_list page. Is this possible?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Komodo IDE better screenshots (worth reading!)

2011-08-01 Thread Thomas Weholt
Hmmm ... I've had the same problem using PyCharm; it just doesn't look
good, but after a while I stopped noticing and started loving the
features of that IDE. Tried PyCharm Cal? The last time I tried Komodo
it crashed big time. I'd been using Komodo for a while and the bugs
might have been fixed now, but I got a license for PyCharm cuz of DSE
and haven't looked at anything else since.

Big thanks to JetBrains for the free license. Apply for a license here
: http://www.jetbrains.com/eforms/openSourceRequest.action?licenseRequest=PCOSL.

Regards,
Thomas

On Wed, Jul 20, 2011 at 2:25 PM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> For me, looks are extremely important when it comes to an IDE, especially
> when I spend 12+ hours a day doing nothing but Django/Python development.
> When looking at Komodo, I *almost* rejected it on the basis that all the
> available screenshots looks hideous.
> OSX: http://www.i-cherubini.it/mauro/blog/uploads/images/ss_Komodo_rails_large.gif
> Linux: http://www.qweas.com/downloads/development/other/scr-komodo-ide.png
> Windows:
> http://www.activestate.com/sites/default/files/images/komodo/platforms_win_720_label.png
> So, after some config modifications, and a few plugins, here is a screenshot
> of how clean/pretty it is now:
> http://i.imgur.com/OsKuL.png
> http://i.imgur.com/UuXmO.png
> For this I'm using:
> font: Consolas 8px
> addons: aero theme, FamFamFam Silk Icons, NST, Tweak UI
> tweak ui: Used to move tabs around the screen
> config: horizontal tabs instead of vertical.
> screen size: 1920x1080
> The toolbox is also a lovely little feature (lets you add all sorts of
> custom macros and auto runs)
> Downside, the 'formatting/reindentation' selection tool is absolutely
> terrible (it just doesn't work lol).
> Hope this helps someone else.
> Cal
>
> --
> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Some thoughts on a package/stack compile system for easy distribution of webapps..

2011-07-06 Thread Thomas Weholt
Anything that can make django/python-based webapps easier to deploy is
interesting. That's been the huge thing for all my PHP-friends; the
ease of deployment. Now if we had something similar for django/python
... it would rock! :-) Used java for some years and war-files worked
ok as well.

And isn't this a trend nowadays; mac having their DMG-files and
discussions in the linux community about making packages distro
independant by compiling libs, binaries, resources etc into one
executable archive?

BTW; could you post the link to showing how the facebook guys are
doing this? Haven't seen it.

Thomas

On Wed, Jul 6, 2011 at 9:03 PM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> Hi all,
>
> After seeing the Facebook video about how their development team
> compiles everything into a single binary for easy distribution between
> thousands of servers, I totally fell in love with the idea. Although
> their approach is to compile PHP into C, the same principle applies.
>
> The end result will be a single binary which will contain your webapp
> + static resources + web server + application server, easily
> deployable to many servers, and reduced time spent in managing the
> stack (YMMV). Although I'm only going to be focusing on our needs to
> begin with, there's no reason this concept couldn't be extended in the
> future to include PHP, 32bit, other OS's etc.
>
> Some features I'm thinking of:
>
> * CLI based menu to build compile package (ncurses based). Easy to
> use. Incorporates all features available in nginx/uwsgi. Comes with
> 'basic' config mode (the bare minimal questions asked - for beginners
> - which makes it almost impossible to build a broken package) and
> 'advanced' mode which lets you change everything (with more risk ofc).
> * Support for nginx + uwsgi + python2.6 + python2.7 + debian 64bit.
> * Expose some sort of API which lets you query all aspects of services
> running within the package (like nginx stats).
> * Enable ability for nginx/uwsgi/python to log out to a syslog server
> of some kind)
> * Ability to obfuscate py code using various techniques.
> * Maybe a test-run feature to test your package.
> * Maybe some sort of MemoryError detection and reporting of such events.
>
> I'm probably going to make something like this for companies own
> internal use, but wanted to see if anyone else had an interest in
> seeing this go open source.
>
> Cal
>
> --
> 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.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



ANN : Kolibri v.0.2.0 - framework for background processing built on celery

2011-07-06 Thread Thomas Weholt
Just released Kolibri v.0.2.0 - NB! alpha/proof-of-concept status.

pypi entry http://pypi.python.org/pypi/Kolibri/0.2.0a
source at https://bitbucket.org/weholt/django-kolibri
Modified BSD license.

What is it? A framework for creating background processes and
workflows using celery. Now with the option of taking input from the
user before executing background tasks.

Screencast at www.weholt.org.

Thanks for your attention.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Calling a custom templatetag inside a block/extrahead-block?

2011-07-04 Thread Thomas Weholt
On Mon, Jul 4, 2011 at 6:09 PM, Ian Clelland  wrote:
> On Monday, July 4, 2011, Thomas Weholt  wrote:
>> I've created a templatetag called {% kolibri_imports %} which I use
>> the in the head-section of my templates. It imports related to
>> stylesheets, javascript libraries etc for my kolibri-package. This
>> works fine when I've control over the base-template I'm extending, but
>> when I want to extend a template which defines a extrahead for me to
>> add stuff to, I get an error trying to call my
>> kolibri_imports-templatetag. Now I want to call that templatetag
>> inside a
>>
>> {% block extrahead %}
>> {% kolibri_imports %}
>> {% endblock %}
>>
>> but I get the following error:
>>
>> Invalid block tag: 'kolibri_imports', expected 'endblock' or 'endblock
>> extrahead'
>>
>> So; How can I call a defined templatetag inside my {% block extrahead
>> %}-block? I've tried
>>
>> {% block extrahead %}
>> {{kolibri_imports }}
>>
>> But that didn't produce anything.
>>
>> This is probably simple, but ... thanks for you input.
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>> --
>> 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.
>>
>>
>
> Are you loading the template tag library in the template that extends the 
> base?

Argh! How did I miss that? I've restructured my templates and didn't
load my own templatetags! I feel embarrased for wasting your time.
Anyway, thanks for your help Ian.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Calling a custom templatetag inside a block/extrahead-block?

2011-07-04 Thread Thomas Weholt
I've created a templatetag called {% kolibri_imports %} which I use
the in the head-section of my templates. It imports related to
stylesheets, javascript libraries etc for my kolibri-package. This
works fine when I've control over the base-template I'm extending, but
when I want to extend a template which defines a extrahead for me to
add stuff to, I get an error trying to call my
kolibri_imports-templatetag. Now I want to call that templatetag
inside a

{% block extrahead %}
{% kolibri_imports %}
{% endblock %}

but I get the following error:

Invalid block tag: 'kolibri_imports', expected 'endblock' or 'endblock
extrahead'

So; How can I call a defined templatetag inside my {% block extrahead
%}-block? I've tried

{% block extrahead %}
{{kolibri_imports }}

But that didn't produce anything.

This is probably simple, but ... thanks for you input.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: ANN: django-iadmin

2011-07-04 Thread Thomas Weholt
Just by looking at the screenshots makes me like it! Alot! :-) Keep up
the great work. I'll see if I get the time to test it and provide you
with more feedback.

Regards,
Thomas

On Mon, Jul 4, 2011 at 4:42 PM, sax  wrote:
> Sorry,
> wiki still in progress.
> anyway demo application in included ( testprj directory), some screenshots
> are available at
> https://github.com/saxix/django-iadmin/tree/master/docs/source/_static or in
> the wiki  section https://github.com/saxix/django-iadmin/wiki
>
> S.
>
> 2011/7/4 Alex Kamedov 
>>
>> I agree with Thomas, It'll be great it you are providing screenshots or
>> demo project.
>>
>> On Mon, Jul 4, 2011 at 7:01 PM, Thomas Weholt 
>> wrote:
>>>
>>> Did you have any screenshots? Didn't see any.
>>>
>>> Thomas
>>>
>>> On Mon, Jul 4, 2011 at 2:55 PM, Stefano Apostolico  wrote:
>>> > Hi all,
>>> >
>>> > I would like some feedback on
>>> > https://github.com/saxix/djangoscreenshots-home-page-iadmin.
>>> >
>>> > Documentation in progress,  but demo application included.
>>> >
>>> > Suggestions and comments are welcome, any help will be appreciated
>>> >
>>> >
>>> > sax
>>> >
>>> >
>>> > --
>>> > 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.
>>> >
>>>
>>>
>>>
>>> --
>>> Mvh/Best regards,
>>> Thomas Weholt
>>> http://www.weholt.org
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Alex Kamedov
>> skype: kamedov    www: kamedov.ru
>>
>> --
>> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: ANN: django-iadmin

2011-07-04 Thread Thomas Weholt
Did you have any screenshots? Didn't see any.

Thomas

On Mon, Jul 4, 2011 at 2:55 PM, Stefano Apostolico  wrote:
> Hi all,
>
> I would like some feedback on
> https://github.com/saxix/djangoscreenshots-home-page-iadmin.
>
> Documentation in progress,  but demo application included.
>
> Suggestions and comments are welcome, any help will be appreciated
>
>
> sax
>
>
> --
> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Ann: DSE v.3.0.0 Beta #1

2011-06-24 Thread Thomas Weholt
On Fri, Jun 24, 2011 at 2:40 PM, Cal Leeming  wrote:
> This is all great news :) Thomas, perhaps we should each make a proposal as
> to how we envisage this in the core, and submit to the list. Ill prob have
> some spare time to write something up after the webcast. That way we have
> two different approaches to choose/cherry pick from :)

Yes, that would be great :-).

> Russ, thanks for letting us know about this.

+1

>
> On 24 Jun 2011 06:49, "Thomas Weholt"  wrote:
>>
>> On Fri, Jun 24, 2011 at 3:54 AM, Russell Keith-Magee
>>  wrote:
>> > On Fri, Jun 24, 2011 at 9:44 AM, Cal Leeming [Simplicity Media Ltd]
>> >  wrote:
>> >>
>> >>
>> >> On Fri, Jun 24, 2011 at 2:34 AM, Russell Keith-Magee
>> >>  wrote:
>> >>>
>> >>> On Fri, Jun 24, 2011 at 9:28 AM, Cal Leeming [Simplicity Media Ltd]
>> >>>  wrote:
>> >>> > +1 on this new feature.
>> >>> > For those that don't understand how this impacts performance, I'm
>> >>> > dedicating
>> >>> > a chunk of the (soon to come) webcast to explaining how this works
>> >>> > and
>> >>> > the
>> >>> > future ideas for monkey-patching the ORM with deferred execution
>> >>> > (which
>> >>> > basically means to make this a 99% drop-in replacement).
>> >>> > For those testing this new DSE feature, please remember to use
>> >>> > manual
>> >>> > transactions, perform dryrun's first, and keep the chunk size low
>> >>> > (as
>> >>> > these
>> >>> > are all factors which need to be changed based on what your data is,
>> >>> > and
>> >>> > what you are doing with it).
>> >>>
>> >>> For the record, Alex Gaynor prepared a patch at DjangoCon Europe that
>> >>> adds bulk inserts to Django's ORM.
>> >>>
>> >>> http://paste.pocoo.org/show/404031/
>> >>>
>> >>> In brief, it means that:
>> >>>
>> >>>    >>> Entry.objects.bulk_create([
>> >>>    ...     Entry(headline="Django 1.0 Released"),
>> >>>    ...     Entry(headline="Django 1.1 Announced"),
>> >>>    ...     Entry(headline="Breaking: Django is awesome")
>> >>>    ... ])
>> >>
>> >> Oh, that's a big game changer then. If bulk_create() is considered for
>> >> the
>> >> core, then that means we have a real good chance of getting
>> >> bulk_update()
>> >> considered too. But, some thought would need to go into how the syntax
>> >> looks.. My guess is it would either be a monkey patch with some defers,
>> >> then
>> >> a call to bulk_update() at the end (how the hell this would work into
>> >> automated transaction management I don't know). Or, it'd be a set of
>> >> new
>> >> functions (i.e. start_bulk_update(), add_bulk_update(),
>> >> execute_bulk_update() ), or something like that..
>> >> Russell, should we get a ticket created for bulk_update to discuss how
>> >> this
>> >> should be done? Or should a proposal be drawn up first and submitted
>> >> for
>> >> comments?
>> >
>> > I think some mailing list discussion is warranted -- bulk insert has a
>> > clear and obvious SQL interpretation; it isn't immediately clear to me
>> > what bulk-update means from a SQL perspective, and why it isn't just a
>> > thin layer of data manipulation over the top of a couple of existing
>> > Django update calls.
>> >
>> > For the record, #7596 is the ticket for bulk insert.
>> >
>> > Yours,
>> > Russ Magee %-)
>>
>> Just the fact that there is a discussion about adding features like
>> this to the django core makes this a very good morning :-). FYI: My
>> testing indicated that updates had the biggest performance gain from
>> DSE or similar concepts.
>>
>> Anyway, this is great news Russ.
>>
>> Thomas
>>
>> --
>> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Ann: DSE v.3.0.0 Beta #1

2011-06-23 Thread Thomas Weholt
On Fri, Jun 24, 2011 at 3:54 AM, Russell Keith-Magee
 wrote:
> On Fri, Jun 24, 2011 at 9:44 AM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
>>
>>
>> On Fri, Jun 24, 2011 at 2:34 AM, Russell Keith-Magee
>>  wrote:
>>>
>>> On Fri, Jun 24, 2011 at 9:28 AM, Cal Leeming [Simplicity Media Ltd]
>>>  wrote:
>>> > +1 on this new feature.
>>> > For those that don't understand how this impacts performance, I'm
>>> > dedicating
>>> > a chunk of the (soon to come) webcast to explaining how this works and
>>> > the
>>> > future ideas for monkey-patching the ORM with deferred execution (which
>>> > basically means to make this a 99% drop-in replacement).
>>> > For those testing this new DSE feature, please remember to use manual
>>> > transactions, perform dryrun's first, and keep the chunk size low (as
>>> > these
>>> > are all factors which need to be changed based on what your data is, and
>>> > what you are doing with it).
>>>
>>> For the record, Alex Gaynor prepared a patch at DjangoCon Europe that
>>> adds bulk inserts to Django's ORM.
>>>
>>> http://paste.pocoo.org/show/404031/
>>>
>>> In brief, it means that:
>>>
>>>    >>> Entry.objects.bulk_create([
>>>    ...     Entry(headline="Django 1.0 Released"),
>>>    ...     Entry(headline="Django 1.1 Announced"),
>>>    ...     Entry(headline="Breaking: Django is awesome")
>>>    ... ])
>>
>> Oh, that's a big game changer then. If bulk_create() is considered for the
>> core, then that means we have a real good chance of getting bulk_update()
>> considered too. But, some thought would need to go into how the syntax
>> looks.. My guess is it would either be a monkey patch with some defers, then
>> a call to bulk_update() at the end (how the hell this would work into
>> automated transaction management I don't know). Or, it'd be a set of new
>> functions (i.e. start_bulk_update(), add_bulk_update(),
>> execute_bulk_update() ), or something like that..
>> Russell, should we get a ticket created for bulk_update to discuss how this
>> should be done? Or should a proposal be drawn up first and submitted for
>> comments?
>
> I think some mailing list discussion is warranted -- bulk insert has a
> clear and obvious SQL interpretation; it isn't immediately clear to me
> what bulk-update means from a SQL perspective, and why it isn't just a
> thin layer of data manipulation over the top of a couple of existing
> Django update calls.
>
> For the record, #7596 is the ticket for bulk insert.
>
> Yours,
> Russ Magee %-)

Just the fact that there is a discussion about adding features like
this to the django core makes this a very good morning :-). FYI: My
testing indicated that updates had the biggest performance gain from
DSE or similar concepts.

Anyway, this is great news Russ.

Thomas

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



Ann: DSE v.3.0.0 Beta #1

2011-06-23 Thread Thomas Weholt
For the impatient:

http://pypi.python.org/pypi/dse/3.0.0.Beta-1
Source at https://bitbucket.org/weholt/dse2/src
Modified BSD license.

New in the 3.x version of DSE is the bulk_update-method, more
intuitive syntax and code clean up.
NB! The new syntax is not backwards compatible so existing code using
DSE must be updated to work.

New syntax:

with Person.delayed as d:
d.insert({'name': 'Thomas', 'age': 36, 'sex': 'M'})
d.update({'id': 1, 'name': 'John'})
d.delete(10) # Deletes record with id 10

I hope the syntax is more intuitive and easy to read. Comments wanted.

Bulk update It takes a dictionary of values to update, requires a
value for the primary key/id of the record, but uses the django orm's
own update method
instead of plain sql to reduce number of statements to execute. This
is helpful when your fields can have a limited set of values, like
EXIF-data from photos or metadata from mp3s.

An example::

with Photo.delayed as d:
d.update({'id': 1, 'camera_model': 'Nikon', 'fnumber': 2.8,
'iso_speed': 200})
d.update({'id': 2, 'camera_model': 'Nikon', 'fnumber': 11,
'iso_speed': 400})
d.update({'id': 3, 'camera_model': 'Nikon', 'fnumber': 2.8,
'iso_speed': 400})
d.update({'id': 4, 'camera_model': 'Canon', 'fnumber': 3.5,
'iso_speed': 200})
d.update({'id': 5, 'camera_model': 'Canon', 'fnumber': 11,
'iso_speed': 800})
d.update({'id': 6, 'camera_model': 'Pentax', 'fnumber': 11,
'iso_speed': 800})
d.update({'id': 7, 'camera_model': 'Sony', 'fnumber': 3.5,
'iso_speed': 1600})
# and then some thousand more lines like that

Internally DSE will construct a structure like this::

bulk_updates = {
'camera_model': {
'Nikon': [1,2,3],
'Canon': [4,5],
'Pentax': [6],
'Sony': [7],
},
'fnumber': {
2.8: [1,3],
11: [2,5,6],
3.5: [4,7],
},
'iso_speed': {
200: [1,4],
400: [2,3],
800: [5,6],
1600: [7]
}
}

And then execute those statements using::

# pk = the primary key field for the model, in most cases id
for field, values in bulk_updates.iteritems():
for value, ids in values.iteritems():
model.objects.filter(**{"%s__in" % pk:
ids}).update(**{field: value})

For huge datasets where the fields can have limited values this has a
big impact on performance. So when to use
update or bulk_update depends on the data you want to process. For
instance importing a contact list where most
of the fields had almost unique values would benefit from the
update-method, but importing data from photos, id3-tags
from your music collection etc would process much faster using bulk_update.

Thanks to Cal Leeming [Simplicity Media Ltd] for inspiration on this one :-)

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Thomas Weholt
On Wed, Jun 22, 2011 at 4:47 PM, Cal Leeming [Simplicity Media Ltd]
 wrote:
>
>
> On Wed, Jun 22, 2011 at 3:25 PM, Andre Terra  wrote:
>>
>> Hello, Cal
>>
>> First of all, congrats on the newborn! The Django community will surely
>> benefit from having yet another success story, especially considering how
>> big this project sounds. Is there any chance you could open-source some of
>> your custom made improvements so that they could eventually be merged to
>> trunk?
>
> Thank you! Yeah, the plan is to release as much of the improvements as open
> source as possible. Although I'd rely heavily on the community to make them
> 'patch worthy' for the core, as the amount of spare time I have is somewhat
> limited.
> The improvements list is growing by the day, and I usually try and post as
> many snippets as I can, and/or tickets etc.
> It sounds like Thomas's DSE might be the perfect place for the bulk update
> code too.

FYI: Inspired by this discussion I've allready started on a similar
feature ( allthough somewhat simplified ) for DSE v2.2.0 and you're
right; the speed increase is huge using the method described here,
even compared to my current solution ( using cursor.executemany ),
which is considerably faster than the django orm allready. My testing
so far have been using postgresql, not sure how mysql will perform. I
expect to release DSE v.2.2.0 with this feature in the next few days.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Thomas Weholt
On Wed, Jun 22, 2011 at 3:52 PM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> Sorry, let me explain a little better.
> (51.98s) Found 49659 objs (match: 16563) (db writes: 51180) (range:
> 72500921 ~ 72550921), (avg 16.9 mins/million) - [('is_checked',
> 49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
> map(lambda x: (x[0], len(x[1])), _obj_incs.iteritems()) = [('is_checked',
> 49659), ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
> In the above example, it has found 49659 rows which need 'is_checked'
> changing to the value '1' (same principle applied to the other 3), giving a
> total of 51,130 database writes, split into 4 queries.
> Those 4 fields have the IDs assigned to them:
>                                     if _f == 'block_images':
>
> _obj_incs.get('is_image_blocked').append(_hit_id)
>                                         if _parent_id:
>
> _obj_incs.get('is_image_blocked').append(_parent_id)
> Then I loop through those fields, and do an update() using the necessary
> IDs:
>                     # now apply the obj changes in bulk (massive speed
> improvements)
>                     for _key, _value in _obj_incs.iteritems():
>                         # update the child object
>                         Post.objects.filter(
>                             id__in = _value
>                         ).update(
>                             **{
>                                 _key : 1
>                             }
>                         )
> So in simple terms, we're not doing 51 thousand update queries, instead
> we're grouping them into bulk queries based on the row to be updated. It
> doesn't yet to grouping based on key AND value, simply because we didn't
> need it at the time, but if we release the code for public use,
> we'd definitely add this in.
> Hope this makes sense, let me know if I didn't explain it very well lol.
> Cal

Actually, I started working on something similar, but tried to find
sets of fields, instead of just updating one field pr update, but
didn't finish it because the actual grouping of the fields seem to
take alot of time/cpu/memory. Perhaps if I focused on updating one
field at the time it would be simpler. Might look at it again for DSE
3.0 ;-)

Thomas

-- 
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: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Thomas Weholt
On Wed, Jun 22, 2011 at 3:36 PM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> Hey Thomas,
> Yeah we actually spoke a little while ago about DSE. In the end, we actually
> used a custom approach which analyses data in blocks of 50k rows, builds a
> list of rows which need changing to the same value, then applied them in
> bulk using update() + F().

Hmmm, what do you mean by "bulk using update() + F()? Something like
"update sometable set somefield1 = somevalue1, somefield2 = somevalue2
where id in (1,2,3 .)" ? Does "avg 13.8 mins/million" mean you
processed 13.8 million rows pr minute? What kind of hardware did you
use?

Thomas

> Here's our benchmark:
> (42.11s) Found 49426 objs (match: 16107) (db writes: 50847) (range: 72300921
> ~ 72350921), (avg 13.8 mins/million) - [('is_checked', 49426),
> ('is_image_blocked', 0), ('has_link', 1420), ('is_spam', 1)]
> (44.50s) Found 49481 objs (match: 16448) (db writes: 50764) (range: 72350921
> ~ 72400921), (avg 14.6 mins/million) - [('is_checked', 49481),
> ('is_image_blocked', 0), ('has_link', 1283), ('is_spam', 0)]
> (55.78s) Found 49627 objs (match: 18516) (db writes: 50832) (range: 72400921
> ~ 72450921), (avg 18.3 mins/million) - [('is_checked', 49627),
> ('is_image_blocked', 0), ('has_link', 1205), ('is_spam', 0)]
> (42.03s) Found 49674 objs (match: 17244) (db writes: 51655) (range: 72450921
> ~ 72500921), (avg 13.6 mins/million) - [('is_checked', 49674),
> ('is_image_blocked', 0), ('has_link', 1971), ('is_spam', 10)]
> (51.98s) Found 49659 objs (match: 16563) (db writes: 51180) (range: 72500921
> ~ 72550921), (avg 16.9 mins/million) - [('is_checked', 49659),
> ('is_image_blocked', 0), ('has_link', 1517), ('is_spam', 4)]
> Could you let me know if those benchmarks are better/worse than using DSE?
> I'd be interested to see the comparison!
> Cal
> On Wed, Jun 22, 2011 at 2:31 PM, Thomas Weholt 
> wrote:
>>
>> Yes! I'm in.
>>
>> Out of curiosity: When inserting lots of data, how do you do it? Using
>> the orm? Have you looked at http://pypi.python.org/pypi/dse/2.1.0 ? I
>> wrote DSE to solve inserting/updating huge sets of data, but if
>> there's a better way to do it that would be especially interesting to
>> hear more about ( and sorry for the self promotion ).
>>
>> Regards,
>> Thomas
>>
>> On Wed, Jun 22, 2011 at 3:15 PM, Cal Leeming [Simplicity Media Ltd]
>>  wrote:
>> > Hi all,
>> > Some of you may have noticed, in the last few months I've done quite a
>> > few
>> > posts/snippets about handling large data sets in Django. At the end of
>> > this
>> > month (after what seems like a lifetime of trial and error), we're
>> > finally
>> > going to be releasing a new site which holds around 40mil+ rows of data,
>> > grows by about 300-500k rows each day, handles 5GB of uploads per day,
>> > and
>> > can handle around 1024 requests per second on stress test on a
>> > moderately
>> > spec'd server.
>> > As the entire thing is written in Django (and a bunch of other open
>> > source
>> > products), I'd really like to give something back to the
>> > community. (stack
>> > incls Celery/RabbitMQ/Sphinx SE/PYQuery/Percona
>> > MySQL/NGINX/supervisord/debian etc)
>> > Therefore, I'd like to see if there would be any interest in webcast in
>> > which I would explain how we handle such large amounts of data, the
>> > trial
>> > and error processes we went through, some really neat tricks we've done
>> > to
>> > avoid bottlenecks, our own approach to smart content filtering, and some
>> > of
>> > the valuable lessons we have learned. The webcast would be completely
>> > free
>> > of charge, last a couple of hours (with a short break) and anyone can
>> > attend. I'd also offer up a Q&A session at the end.
>> > If you're interested, please reply on-list so others can see.
>> > Thanks
>> > Cal
>> >
>> > --
>> > 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
>> > htt

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-06-22 Thread Thomas Weholt
Yes! I'm in.

Out of curiosity: When inserting lots of data, how do you do it? Using
the orm? Have you looked at http://pypi.python.org/pypi/dse/2.1.0 ? I
wrote DSE to solve inserting/updating huge sets of data, but if
there's a better way to do it that would be especially interesting to
hear more about ( and sorry for the self promotion ).

Regards,
Thomas

On Wed, Jun 22, 2011 at 3:15 PM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> Hi all,
> Some of you may have noticed, in the last few months I've done quite a few
> posts/snippets about handling large data sets in Django. At the end of this
> month (after what seems like a lifetime of trial and error), we're finally
> going to be releasing a new site which holds around 40mil+ rows of data,
> grows by about 300-500k rows each day, handles 5GB of uploads per day, and
> can handle around 1024 requests per second on stress test on a moderately
> spec'd server.
> As the entire thing is written in Django (and a bunch of other open source
> products), I'd really like to give something back to the community. (stack
> incls Celery/RabbitMQ/Sphinx SE/PYQuery/Percona
> MySQL/NGINX/supervisord/debian etc)
> Therefore, I'd like to see if there would be any interest in webcast in
> which I would explain how we handle such large amounts of data, the trial
> and error processes we went through, some really neat tricks we've done to
> avoid bottlenecks, our own approach to smart content filtering, and some of
> the valuable lessons we have learned. The webcast would be completely free
> of charge, last a couple of hours (with a short break) and anyone can
> attend. I'd also offer up a Q&A session at the end.
> If you're interested, please reply on-list so others can see.
> Thanks
> Cal
>
> --
> 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.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: ANN: django-kolibri - a concept for Asynchronous Processors/Workflow management for django.

2011-06-22 Thread Thomas Weholt
On Wed, Jun 22, 2011 at 2:01 PM, Ethan Jucovy  wrote:
> On Tue, Jun 21, 2011 at 5:09 PM, Thomas Weholt 
> wrote:
>>
>> Proof of concept. Need comments. Released under a modified BSD-license.
>>
>> http://pypi.python.org/pypi/Kolibri/0.1.0a
>>
>> or better
>>
>> https://bitbucket.org/weholt/django-kolibri
>>
>> There's a blogpost with two screencasts at http://weholt.blogspot.com/ as
>> well.
>
> Looks very cool, I'm looking forward to trying it out.
>
>>
>> NB! If anybody can tell me why my my pypi-entry don't get formatted
>> like restructured text that would be swell. Thanks!
>
> Usually this happens when your long_description doesn't validate properly as
> ReST.  I use the collective.checkdocs package to validate and fix ReST
> syntax errors before uploading a release.  Use it like:
> $ pip install collective.checkdocs
> $ cd src/django-kolibri
> $ python setup.py checkdocs
> It will emit ReST validation errors and warnings, with line numbers.  Fix
> those and then re-register the package data (`python setup.py register`) and
> the ReST will render properly on the PyPI page.
> -Ethan

Thanks a bunch Ethan!! You made my day. :-)

Thomas

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

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: ANN: django-kolibri - a concept for Asynchronous Processors/Workflow management for django.

2011-06-21 Thread Thomas Weholt
On Tue, Jun 21, 2011 at 11:16 PM, Calvin Spealman  wrote:
> Interesting project. My first question was going to be "Why aren't you
> just using Celery?" until I got to the part of the description that
> says it is built on *top* of celery.

Yes, it might be a good idea to put that in the beginning of the info.

> The first question that comes up for me is how or if you track which
> processes have already been run, to keep them from being executed more
> than they should. For example, if you had a process that blurred
> uploaded images, you wouldn't want it run more than once, because it
> is destructive.

Well, each time a processor is executed it creates a record in the
database, with a link to the item it processed. The current system
will show if some processor has been used on a given model instance
before, but nothing is stopping you from processing that instance
again. Perhaps the processor could have some extra property saying if
it should only be executed once for any given item? A possible 0.2.0
feature :-).

Thanks for your interest :-)

Thomas

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



ANN: django-kolibri - a concept for Asynchronous Processors/Workflow management for django.

2011-06-21 Thread Thomas Weholt
Proof of concept. Need comments. Released under a modified BSD-license.

http://pypi.python.org/pypi/Kolibri/0.1.0a

or better

https://bitbucket.org/weholt/django-kolibri

There's a blogpost with two screencasts at http://weholt.blogspot.com/ as well.

NB! If anybody can tell me why my my pypi-entry don't get formatted
like restructured text that would be swell. Thanks!

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Multiple forms into one form/trouble accessing form fields

2011-06-15 Thread Thomas Weholt
I got several forms I need to display in one page and post to one
site. Actually, what I want to do is take all the fields from all the
forms and display them as one form and post all input to one view. To
avoid collision between the form fields I want to prefix the fields
somehow.

Say I got three forms:

class UserInputForm1(forms.Form):
username = forms.CharField()
password = forms.CharField()

class UserInputForm2(forms.Form):
comment = forms.CharField()

class UserInputForm3(forms.Form):
like = forms.BooleanField()

I want to put all fields, from all three forms, into one new form and
prefix each field so I know what form the field came from. How can I
do that? When I access the fields after creation it appears to be a
string.

An alternative to this is a FormWizard, but that makes the user click
thru a bunch of steps, which could be avoided if I could get all the
fields into one new form.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Trouble with simple aggregation

2011-06-08 Thread Thomas Weholt
Say I got a model like so:

class Article(models.Model):
title = models.CharField(max_length=100)
text = models.TextField()
category = models.CharField(max_length=20)
author = models.CharField(max_length=50)

Article.objects.create(title="Foo", text="Story about foo",
category="adventure", author="jane")
Article.objects.create(title="Bar", text="Story about bar",
category="adventure", author="joe")
Article.objects.create(title="Cheese", text="Story about cheese",
category="adventure", author="joe")
Article.objects.create(title="Perl", text="Story about perl",
category="horror", author="jane")
Article.objects.create(title="Java", text="Story about java",
category="horror", author="joe")
Article.objects.create(title="Pizza", text="Story about pizza",
category="cooking", author="joe")

I've tried to use aggregation to find how many articles written by joe
there are of each category, but so far I'm not getting anywhere.

Desired output:

[
{'category': 'adventure', 'count': 2},
{'category': 'horror', 'count': 1},
{'category': 'cooking', 'count': 1}
]

I just cant get my head wrapped around the orm aggregation, in this is
easy using raw SQL, but I don't want to.

-- 
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 get user object from RequestContext?

2011-05-30 Thread Thomas Weholt
How do I get the user related to the current request in templatetag?
Using RequestContext?

@register.tag(name='sometag')
def sometag(parser, token):
try:
tagname, model_inst = token.split_contents()
except ValueError:
raise template.TemplateSyntaxError, "%r tag requires exactly
one argument" % tagname

return FormatNode(model_inst)


class FormatNode(template.Node):

def __init__(self, model_inst):
self.model_inst = template.Variable(model_inst)

def render(self, context):
try:
p = self.model_inst.resolve(context)
# Here I'd like to get hold of the user object, but how??
except Exception, e:
return ''

Thanks in advance,
Thomas

-- 
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 development with iPad as target platform?

2011-05-27 Thread Thomas Weholt
I just got my hands on an iPad and was wondering if anybody has done
any django development where the iPad was the target
platform/browser/client?

Thanks in advance and expect some django-app aimed at ipad in the near
future ;-).

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Master/detail in the admin

2011-05-25 Thread Thomas Weholt
I've googled and looked at the docs, but haven't found anything
related to this scenario:

I got a master/detail model, defined like so:

class Master(models.Model):
title = models.CharField(max_length=100)

def details_url(self):
return 'Details'
 self.content_object)
details_url.short_description = 'Link to details'
details_url.allow_tags = True

class Detail(models.Model):
master = models.ForeignKey(Master)
details = models.TextField()

They're exposed in the admin using admin.py. My question is this:

1) How can I make the details_url property in the Master-model so that
when exposed in the admin.py a user can click it and go the listing of
details and only see details related to that instance of Master-model?
2) If this can only be done using a custom view, how do I get the view
to produce a page looking like the rest of the admin? I know I can use
the same template code as the admin, but is there a faster way to
produce for instance listings like the details in my case? Generic
views/classes?
3) Adding Master to list_filter for the detailsAdmin-class is not
possible due to the amount of Master-records. Or is it ...? And even
if it was possible, how can I set filters from another page, like if I
click a link in the change_list for Master-model going to the Details
change_list, how can I set the filtering to be set to a specific
instance of a Master model?

In short; all I want is the have the change_list filtered to only show
details related to a specific master-record and reuse as much of the
admin-code/featurebase as possible.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



ANN: DSE 2.0.0-RC1, now using the BSD license.

2011-05-18 Thread Thomas Weholt
Inserting or updating a lot of data using the django orm? Not too
happy with the performance? Try DSE. Typical performance gain 3X on
insert, 5-10x on updates - and still it's django-friendly and easy to
use. No manual SQL-generating. Default values in models respected.

DSE is now released under the BSD license ( and that's the only change
compared to beta9 ).

http://pypi.python.org/pypi/dse/2.0.0-RC1

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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 choose a license for an app or a project?

2011-05-13 Thread Thomas Weholt
On Fri, May 13, 2011 at 6:55 PM, Jacob Kaplan-Moss  wrote:
> On Fri, May 13, 2011 at 11:30 AM, Thomas Weholt  
> wrote:
>> Hmmm ... maybe, but because of the reusable app focus in django I
>> think some sort of guideline regarding choice of license could be
>> important.
>
> The problem is that license choice is one of those "holy wars" that
> geeks get into -- vi/emacs, mac/windows/linux, etc. etc. etc. Only
> it's worse because you've got a bunch of laypeople trying to interpret
> law, and we developers tend to fail rather spectacularly when trying
> to interpret the law.
>
> So any "official" advice anyone gave would just be a flashpoint for
> flamewars, and I don't think anyone's brave enough to wade into this
> particular problem. I'm certainly not.
>
> I would like to make a few important points, though:
>
> First, if you have a license you want (or need) to use: use it. Don't
> let anyone tell you otherwise. It's *YOUR* software, and *YOU* get to
> choose how to license it. I'd hope that you're making an educated
> choice, but even if you're picking by throwing darts that's still your
> prerogative.
>
> That said, you do need to understand that licenses are more than just
> legal terms of use. They're also important community signifiers. What
> do I mean by "signifier"? Well, imagine you're in a meeting and
> someone you don't know walks in wearing a suit. You'll have an
> immediate first impression ("ah, here's a business guy") that'd differ
> from seeing someone walk in wearing sandals and at-shirt ("hey, who's
> the new developer?")
>
> Well, licenses do that, too. A permissive, BSD-ish license sends a
> message that's quite a bit different from the one sent by a
> strong-copyleft GPL-ish license. It's hard to articulate just what
> these messages are -- I have strong feelings on the matter so I can't
> really talk dispassionately.
>
> But I can point out that one of the most important aspects of this
> message is one of membership and involvement. Again, think about the
> meeting example: if you were going to attend a meeting with a bunch of
> developers would you wear a suit? Maybe you would, but you'd probably
> know they'd instantly peg you as an outsider. This could be useful --
> if you're trying to buy a startup, you probably *want* to look
> important and successful. But either way you probably know your
> clothes send signifiers about how you see yourself in relation to the
> community.
>
> Again, licenses to that, too. In the Python and Django world,
> permissive licenses are the norm. Python's licensed under a permissive
> license (it's a weird one for historical purposes, but it's most like
> the Apache license I think). Django's licensed under one of the most
> permissive licenses available (the BSD license). Many Python projects,
> and most Django apps, are BSD or MIT licensed. This means that putting
> a GPL-licensed Django app is going to immediately stick out as
> something a bit different.
>
> I'm *NOT* saying that you should be choosing a license just to "fit
> in"! Again, it's *YOUR* choice. The point I'm making is that the
> social messages your license sends can be just as important as the
> legal rights those license grant. In many cases, the social factors
> can be more important than the legal ones.
>
> Good luck, I hope I've not confused things even more for you!
>
> Jacob

No, you're not confusing me at all - you're making things very clear
and this is exactly what I wanted; to shed some light on what
difference choosing one license over another can make to your project.
And the point you're making about the non-legal isssues are just as
important for me as I want to "use" the community to make my own
software better. Hmmm ... as one of those copylefters it's somewhat of
a bitter pill to swallow not to use the GPL. Still - I'm a
django/python-user and if I want to succeed and increase my userbase I
might have to put the thinking and philosophy that got me into linux
and open source initially aside and use a license most compatible with
the framework and community I want to contribute to.

Thanks Jacob, this was very enlightening.

Thomas

-- 
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 choose a license for an app or a project?

2011-05-13 Thread Thomas Weholt
> Look at it this way:
>
> If you want to force contribution back to your project, then AGPL or GPL3.
> This limits participation of people who want to use your code in their
> products or SAAS services because it forces them to release their
> customizations for free.

Well, I think that's my main motivation for releasing my code as GPL;
people are free to use it, modify it, redistribute it, even sell it as
part of a larger piece of software, but the only thing I want in
return is that their modifications of "my" code are made public for me
to use as well so I can benefit from bug fixes, added features etc. So
I still believe GPL is the right license for me to use.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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 choose a license for an app or a project?

2011-05-13 Thread Thomas Weholt
On Fri, May 13, 2011 at 4:15 PM, Tom Evans  wrote:
> On Fri, May 13, 2011 at 3:05 PM, Boštjan Mejak  
> wrote:
>> For example, the CCleaner GUI application provides only the setup (so the
>> binaries) of the application. They don't give the source code of it. If I
>> wanted the same thing with my app, is the MIT license the right choice for
>> me?
>>
>
> If you use the MIT license, anyone receiving the license can do
> whatever they want with the code, including distribute the code, or
> binaries derived from the code without the accompanying code.
>
> This is OT from django now..

Hmmm ... maybe, but because of the reusable app focus in django I
think some sort of guideline regarding choice of license could be
important. This is important to all communities, and in that sense not
strictly django related, but I think the number of answers in this
thread show that it's something several django users care about - at
least to some degree.

Thomas

-- 
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 choose a license for an app or a project?

2011-05-13 Thread Thomas Weholt
I've released three django-related packages the last few months, all
under the GPL license. Recently somebody asked me about my license
choice; "Why not BSD, the same as django?". My reason for choosing GPL
is based on the fact that I'm a strong supporter of free software as
defined by FSF and GPL is the de facto standard license for that. But
the question got me thinking and I wonder what kind of problems I
might run into using the GPL, and not the BSD license.

Do people really care? Should I care? I think so. What do you people
think; How to choose a license and why?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: CharField with choices gets no ... choices

2011-05-12 Thread Thomas Weholt
On Thu, May 12, 2011 at 10:09 AM, Jani Tiainen  wrote:
> On Thu, 2011-05-12 at 09:59 +0200, Thomas Weholt wrote:
>> I got a model looking something like this
>>
>> class SomeModel(models.Model):
>>     somefield = models.CharField(max_length=100, choices=somemethod())
>>
>> The problem is that somemethod, which produces the choices to give in
>> the form in the admin, is called when the module is imported, not when
>> the form instance is created. The result from the somemethod call is
>> dynamic based on custom user defined code and not some static tuple or
>> list.
>>
>> So my question is: how can I get the choices to be set at the time of
>> form creation? Tried overriding the __init__, but then somefield was
>> only available as a string and I could not set any choice-property.
>
> You hit common "problem". You do assignment of function/method call
> result not the callable itself. Small but significant difference.
>
> So whenever somefield = models.Charfield(choices=somemethod()) is
> evaluated it uses result of method call. And due the way objects are
> called value is put there when class itself is constructed (imported).
> This is just how it works with Python.
>
> To be able to do dynamic chocies (which also is documented that
> something might be wrong if choices are dynamic)) you have to pass
> callable - which in python means that leave out parenthesis:
>
> somefield = models.CharField(choices=somemethod)

Ah crap!! Of course. Thanks alot Jani :-)

Thomas

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



CharField with choices gets no ... choices

2011-05-12 Thread Thomas Weholt
I got a model looking something like this

class SomeModel(models.Model):
somefield = models.CharField(max_length=100, choices=somemethod())

The problem is that somemethod, which produces the choices to give in
the form in the admin, is called when the module is imported, not when
the form instance is created. The result from the somemethod call is
dynamic based on custom user defined code and not some static tuple or
list.

So my question is: how can I get the choices to be set at the time of
form creation? Tried overriding the __init__, but then somefield was
only available as a string and I could not set any choice-property.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Problems using django-taggit; tags disappear in the admin

2011-05-11 Thread Thomas Weholt
I got a model using django-taggit. It works great when I add tags in
the admin, but when the tags are added in code ( they're read from the
EXIF-data in a photo, the keywords part ) - nothing is shown in the
admin change form tag-field for the model. I can see the values are
stored correctly when I debug the save-method, but when the model
instance is shown in the admin the tag-field is empty.

>>> from photoapp.models import *
>>> d = AdvancedPhoto(title='1', image='/home/thomas/Pictures/test.jpg')
>>> d.save()
>>> d.tags.all()
[, , ]
>>> AdvancedPhoto.objects.all()[1].tags.all()
[, , ]

This works fine. Saving/adding a photo in the admin and then checking
it in the shell afterwards:
>>> from photoapp.models import *
>>> AdvancedPhoto.objects.all()[0].tags.all()
[]

Hmmm ... what's going on??


-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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 use django-taggit in admin.py?

2011-05-11 Thread Thomas Weholt
I want to show tags used in a model in my admin.py file, to be able to
sort by tag etc. but it crashes with "Caught AttributeError while
rendering: 'TaggableManager' object has no attribute 'flatchoices'" if
I add 'tags' to list_filter in my ModelAdmin.

How can I use django-taggit in the admin related to my model?
-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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: performance of model instgance save()

2011-05-11 Thread Thomas Weholt
On Wed, May 11, 2011 at 10:21 AM, Daniel Roseman  wrote:
> On Wednesday, May 11, 2011 7:50:16 AM UTC+1, Brian wrote:
>>
>> Sure - it's just that bit more convenient and readable to use the ORM
>> approach. If I get the chance, I must try substituting direct calls to
>> psycopg and see if that makes it significantly faster again. I'd guess
>> there's maybe another factor of 2 to be had.
>
> I'd think you'll find it's significantly more than a factor of 2. For bulk
> inserts, raw SQL is often several orders of magnitude faster.


You might want to check out http://pypi.python.org/pypi/dse/. My tests
using postgres showed a 3X performance gain on inserts compared to
using the orm and nearly 10X when doing heavy updates on existing
data. It takes care of creating SQL for you and respects default
values defined in your models.

Thomas

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



  1   2   >