Re: Where Is My Javascript Code's Problem?

2011-01-24 Thread Piotr Zalewa
I think you wanted something like this to happen:
http://jsfiddle.net/zalun/96vsU/

zalun

On 01/21/11 21:41, hank23 wrote:
> I was actually hoping to see the results of the code altering the
> screen fields dynamically when I click the button to call the
> javascript function. So if this won't do it, then how do I through the
> javascript function code cause the screen fields to be refreshed when
> the code changes them?
> 
> On Jan 21, 3:35 pm, "Mo J. Al-Mughrabi"  wrote:
>> Lol
>>
>> Sent from my iPhone
>>
>> On Jan 22, 2011, at 12:34 AM, Sandro Dutra  wrote:
>>
>> LOL! What are you trying to do, guy?
>>
>> It's obvius the alert box will appear, 'cause it's a visual element.
>>
>> But the rest of the code only set a bunch of variables, it's not printing
>> anything, it's not launching any alert, so what are you waiting to happen?
>>
>> 2011/1/21 hank23 
>>
>>
>>
>>
>>
>>> Here's my javascript function code:
>>
>>>  function addRecipient()
>>>  {
>>>  alert("Entering addRecipient function!")
>>>  var list = document.getElementById('recipientlist');
>>>  var rlist = list.value;
>>>  var reciever = document.getElementById('recipient');
>>>  rlist = rlist + receiver.value + ", ";
>>>  reciever.value = "";
>>>  }
>>
>>> I get the alert box just fine, but nothing seems to happen after that.
>>> So what's wrong with the code as is and do I need to call some other
>>> method to refresh the browser window to show the results of my
>>> javascript having run, in order to see my screen change?
>>
>>> --
>>> 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 
>> athttp://groups.google.com/group/django-users?hl=en.- Hide quoted text -
>>
>> - Show quoted text -
> 


-- 
blog  http://piotr.zalewa.info
jobs  http://webdev.zalewa.info
twit  http://twitter.com/zalun
face  http://facebook.com/zaloon

-- 
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 Deployment Statistics (via djangosites.org)

2011-01-24 Thread Ross Poulton
On Jan 23, 4:11 pm, Shawn Milochik  wrote:
> Cool. I just submitted a couple of sites myself.

Along with a bunch of others - looks like this post caused a flurry of
new submissions & updates to existing listings :)

On Jan 23, 5:27 pm, Graham Dumpleton 
wrote:
> For each category, is there a list to choose from or up to people to enter
> in right name? Is odd that uWSGI doesn't even get a mention for serving
> method.

Yes, there is a list. uWSGI was an oversight on my behalf; I've now
added that in to the list. As soon as there are sites submitted by
people who select uWSGI it'll be included in the charts.

On Jan 24, 12:14 am, Aryeh Leib Taurog  wrote:
> Thanks!  I'm surprised that so few are running on google app engine; I
> would have expected google's user base to be significantly larger than
> windows'.

Remember this is purely based on people who a) list their site at
djangosites.org and b) offer up this information. The difference in
numbers could purely be because App Engine users haven't submitted
their sites for whatever reason.

> p.s. Could you add permalinks/id attributes to the  elements
> please?

Great idea! You can now visit eg 
http://www.djangosites.org/stats/#serving-method
if you want to deep-link to a particular chart.

Thanks for the comments all!

Warm Regards,

Ross

-- 
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 Deployment Statistics (via djangosites.org)

2011-01-24 Thread Graham Dumpleton


On Monday, January 24, 2011 7:17:24 PM UTC+11, Ross Poulton wrote:
>
> On Jan 23, 4:11 pm, Shawn Milochik  wrote: 
> > Cool. I just submitted a couple of sites myself. 
>
> Along with a bunch of others - looks like this post caused a flurry of 
> new submissions & updates to existing listings :) 
>
> On Jan 23, 5:27 pm, Graham Dumpleton  
> wrote: 
> > For each category, is there a list to choose from or up to people to 
> enter 
> > in right name? Is odd that uWSGI doesn't even get a mention for serving 
> > method. 
>
> Yes, there is a list. uWSGI was an oversight on my behalf; I've now 
> added that in to the list. As soon as there are sites submitted by 
> people who select uWSGI it'll be included in the charts. 
>

What does the generic 'WSGI' meant to mean? Is that meant to mean 'WSGI 
(Other)'? Ie., as not covered by other options?

Graham

 

> On Jan 24, 12:14 am, Aryeh Leib Taurog  wrote: 
> > Thanks!  I'm surprised that so few are running on google app engine; I 
> > would have expected google's user base to be significantly larger than 
> > windows'. 
>
> Remember this is purely based on people who a) list their site at 
> djangosites.org and b) offer up this information. The difference in 
> numbers could purely be because App Engine users haven't submitted 
> their sites for whatever reason. 
>
> > p.s. Could you add permalinks/id attributes to the  elements 
> > please? 
>
> Great idea! You can now visit eg 
> http://www.djangosites.org/stats/#serving-method 
> if you want to deep-link to a particular chart. 
>
> Thanks for the comments all! 
>
> Warm Regards, 
>
> Ross

-- 
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 Deployment Statistics (via djangosites.org)

2011-01-24 Thread Ross Poulton
That was added a few months (or more?) back after some users emailed me asking 
me to add "wsgi" to the list. Admittedly in hindsight it's a little vague and 
has probably ended up being a catch-all for "wsgi: other". 

-- 
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: Adding to admin logic

2011-01-24 Thread Daniel Roseman
On Sunday, January 23, 2011 7:45:04 PM UTC, Tom Wieland wrote:
>
> Hello,
>
> I am trying to get the company that I work at to use Django and Python
> for future webdevelopment (whereas now that is done with PHP). We have
> lots of different customers with lots of different website needs so
> the datamodel is different so webframeworks are good choice (over CMS
> maybe) and Django rocks so use that, is the reasoning :P.
>
> To make a use case and test the framework out I'm making an app called
> treepages that with models Page (tree) and Field I can make a
> structure of webpages with editable fields in the backend. I could use
> the admin to add and remove fields and maybe even disable that
> functionality in production for that site so they can only change page
> content, not structure.
>
> The way I'd like it to work is to change the index view of the page
> model of the treepages app in the admin to my custom view function.
> The problem here for me is that even if I make a route to my own app
> controller instead of the admin one I don't know if and how I can get
> my own view function to behave like an django admin view but then
> include my own logic i.e. how do I integrate with the admin 'session'.
>
> Later I might be interested in changing other views in the admin as
> well to for example have a custom 'dashboard' on the index view when
> enabled in the 'misc settings' view etc.
>
> I understand that this might have been asked before but even if the
> admin wasn't really made for this (though it's all strictly adminny
> stuff meant for the client administrators and not the frontend users
> of the site..) is it possible?
>
> Greetings,
>
> Tom Wieland
>
>
On Sunday, January 23, 2011 7:45:04 PM UTC, Tom Wieland wrote:
>
> Hello,
>
> I am trying to get the company that I work at to use Django and Python
> for future webdevelopment (whereas now that is done with PHP). We have
> lots of different customers with lots of different website needs so
> the datamodel is different so webframeworks are good choice (over CMS
> maybe) and Django rocks so use that, is the reasoning :P.
>
> To make a use case and test the framework out I'm making an app called
> treepages that with models Page (tree) and Field I can make a
> structure of webpages with editable fields in the backend. I could use
> the admin to add and remove fields and maybe even disable that
> functionality in production for that site so they can only change page
> content, not structure.
>
> The way I'd like it to work is to change the index view of the page
> model of the treepages app in the admin to my custom view function.
> The problem here for me is that even if I make a route to my own app
> controller instead of the admin one I don't know if and how I can get
> my own view function to behave like an django admin view but then
> include my own logic i.e. how do I integrate with the admin 'session'.
>
> Later I might be interested in changing other views in the admin as
> well to for example have a custom 'dashboard' on the index view when
> enabled in the 'misc settings' view etc.
>
> I understand that this might have been asked before but even if the
> admin wasn't really made for this (though it's all strictly adminny
> stuff meant for the client administrators and not the frontend users
> of the site..) is it possible?
>
> Greetings,
>
> Tom Wieland
>

There's nothing special about integrating with the admin 'session' - it just 
works on the basis of the normal logged-in user, as available via 
request.user, just like any other Django view. 

However to answer the question about providing your own admin logic, you can 
add views as methods in your ModelAdmin subclass and then override the 
get_urls method to return a URLconf which points to the new methods. See the 
documentation:
http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_urls
--
DR.

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



Changed app_label in class meta and now user can't see application in admin backend

2011-01-24 Thread mongoose
Hi there,

I'm using the Coltrane Blog.
I changed

Class Meta:
app_label = 'Blog'

Now Entries in under Blog instead of Coltrane. Great this is what I
want.

However now I have created a user with privileges to add, edit and
delete entries for Coltrane app. I assigned the privileges under Users
in the admin backend.

Now when my user signs in he can't see the Blog? If I take away
app_label then the user sees the blog as Coltrane. If I assign
Superuser status to a user they can see the app.

Is it not possible to changes an app_label and still have a user see
the app?

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



additional infor to startind Django on Windows7

2011-01-24 Thread gintare
I would lile to add information to  unanswered thread
http://groups.google.com/group/django-users/browse_thread/thread/6bdc81a65804fde2/f94f116fe77c0c97?lnk=gst&q=gintare+start#f94f116fe77c0c97

In the end on windows7 Django worked from comman line (start, print
cmd):

cd c:\Python27\Scripts
c:\Python27\python django-admin.py --version

regards,
gintare

p.s
Django was installed in  c:\Python27\Lib\site-packages
by running from cmd
cd  c:\FolderWithUn7zipDjango
c:\Python27\python setup.py install



-- 
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/Cherokee performance on vServer

2011-01-24 Thread Ivo Brodien
I am running a Django Site behind Cherokee on a vServer and I have 6 of these 
threads (started by Cherokee)

python /pathToMy/manage.py runfcgi protocol=scgi host=127.0.0.1 port=58944

My vServer runs on Debian and has 256 MB RAM.

At the moment, when I test the performance it is ok, but I  don’t know what 
happens, when there will be more users...there will not be much traffic on the 
side, but still I was wondering if I can do anything to boost performance like 
starting a the scgi process with threaded support or is cherokee already doing 
this? (because there 6 instances running)


(I will x-post on the cherokee list)

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



Cant find out the "OR" in query

2011-01-24 Thread nicolas lubkov
hi all is pretty simple my question.

when im making a query in django i use this

result = person.objects.filter(name = "nick", lastname = "smith")

this is like "select * from person where name = 'nick' and lastname = 'smith

i cant figure it out how to make
  "select * from person where name = 'nick' OR lastname = 'smith


-- 
Saludos.

Nicolas Lubkov
Ing. Informatica de gestion

-- 
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: Why I cannot save an object in administration?

2011-01-24 Thread Maxim Mai
it'd be helpful if you can paste the output of your python manage.py
runserver
and please check that if the debug mode is enabled, it will give you
more info when you develop/test your application

Maxim

On Jan 23, 12:48 am, Flo  wrote:
> Hi all,
>
> I'm a new comer to Django. As a first step, I use Django
> Administration to manage my objects. But whenever I added or changed
> an object(or a user, the same thing), then click the "Save" button,
> the page just jumped to an error page, which said "the page cannot be
> displayed". It seems that Django redirected the page to an unkonw
> site.
>
> I'm using Django 1.2.4 & Python 2.6.6 in WinXP.
>
> Any help will be highly appreciated. Thanks!!
>
> Flo

-- 
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: Cant find out the "OR" in query

2011-01-24 Thread Konrad Delong
On 24 January 2011 07:18, nicolas lubkov  wrote:
> hi all is pretty simple my question.
> when im making a query in django i use this
> result = person.objects.filter(name = "nick", lastname = "smith")
>
> this is like "select * from person where name = 'nick' and lastname = 'smith
> i cant figure it out how to make
>   "select * from person where name = 'nick' OR lastname = 'smith


You want to use the Q object

http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects

cheers,
Konrad

-- 
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: Cant find out the "OR" in query

2011-01-24 Thread Matias Aguirre
Excerpts from nicolas lubkov's message of Mon Jan 24 04:18:18 -0200 2011:
> hi all is pretty simple my question.
> 
> when im making a query in django i use this
> 
> result = person.objects.filter(name = "nick", lastname = "smith")
> 
> this is like "select * from person where name = 'nick' and lastname = 'smith
> 
> i cant figure it out how to make
>   "select * from person where name = 'nick' OR lastname = 'smith

Take a look to Q objects:

http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects
-- 
Matías Aguirre 

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

2011-01-24 Thread Derek
1. Not sure about those you mention, but have a look at:
http://www.nosqldatabases.com/main/2010/7/27/django-and-neo4j-domain-modeling-that-kicks-ass.html

2. See: 
http://stackoverflow.com/questions/238081/how-do-you-log-server-errors-on-django-sites

(Disclaimer - I do not work with any of these projects... best to
contact the developers direct)

On Jan 23, 1:05 pm, HOYAJIGI  wrote:
> 1, Is it possible to use NoSQL(HBase or Cassandra) rather than SQL
> server in Django?
>
> 2. Is there any web log analysis "middleware" for django?
>    If not why not make one?

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



model array to javascript

2011-01-24 Thread nicolas lubkov
hello all i was wandering if its possible to pass a model.objects.filter()
array like ¨Category¨ and ¨ Sub-category ¨ to JavaScript.

this is meant to be used in a JavaScript function to fill
a Combo-box Sub-category by changing the Combo-box ¨¨Category¨

-- 
Saludos.

Nicolas Lubkov
Ing. Informatica de gestion

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



In Apache Configuration, What Replaces mod_python

2011-01-24 Thread octopusgrabbus
I'm trying to reconfigure to mod_wsgi and am wisely starting with a
workstation.

What changes in this line which is in full context below:
PythonHandler django.core.handlers.modpython

modpython changes, but to what does it change?

Listen 8002

WSGIScriptAlias / /home/amr/django/django.wsgi
Alias /media /home/amr/django/amr/media

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings
SetEnv PYTHON_EGG_CACHE /tmp/.python_eggs
PythonOption django.root /home/amr/django/amr
PythonPath "['/home/amr/bin', '/home/amr/django', '/home/amr/
django/amr'
, '/home/amr/django/amr/media'] + sys.path"
PythonDebug On


-- 
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: In Apache Configuration, What Replaces mod_python

2011-01-24 Thread Daniel Roseman
On Monday, January 24, 2011 3:10:17 PM UTC, octopusgrabbus wrote:
>
> I'm trying to reconfigure to mod_wsgi and am wisely starting with a 
> workstation. 
>
> What changes in this line which is in full context below: 
> PythonHandler django.core.handlers.modpython 
>
> modpython changes, but to what does it change? 
>
> Listen 8002 
>  
> WSGIScriptAlias / /home/amr/django/django.wsgi 
> Alias /media /home/amr/django/amr/media 
>  
> SetHandler python-program 
> PythonHandler django.core.handlers.modpython 
> SetEnv DJANGO_SETTINGS_MODULE settings 
> SetEnv PYTHON_EGG_CACHE /tmp/.python_eggs 
> PythonOption django.root /home/amr/django/amr 
> PythonPath "['/home/amr/bin', '/home/amr/django', '/home/amr/ 
> django/amr' 
> , '/home/amr/django/amr/media'] + sys.path" 
> PythonDebug On 
>  
>

It doesn't change to anything. That whole  section is now 
irrelevant, as the documentation clearly shows.
--
DR.
 

-- 
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: In Apache Configuration, What Replaces mod_python

2011-01-24 Thread Patrick McDonnell
On Mon, Jan 24, 2011 at 10:10 AM, octopusgrabbus
wrote:

> I'm trying to reconfigure to mod_wsgi and am wisely starting with a
> workstation.
>
>
If I'm understanding you correctly, you're trying to migrate from using
apache/mod_python to serve your Django project to apache/mod_wsgi, right?
If this is the case, is there something special about your setup such that
the instructions at
http://docs.djangoproject.com/en/1.2/howto/deployment/modwsgi/ don't apply?

-- 
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: model array to javascript

2011-01-24 Thread Patrick McDonnell
I would recommend first converting it to an intermediary format, such as
JSON or XML, as described here:
http://docs.djangoproject.com/en/1.2/topics/serialization/

You can then use JavaScript to easily manipulate it in whatever way you
want.  This is basically the approach I take when doing AJAXy things.

HTH

On Mon, Jan 24, 2011 at 9:56 AM, nicolas lubkov  wrote:

> hello all i was wandering if its possible to pass a model.objects.filter()
> array like ¨Category¨ and ¨ Sub-category ¨ to JavaScript.
>
> this is meant to be used in a JavaScript function to fill
> a Combo-box Sub-category by changing the Combo-box ¨¨Category¨
>
> --
> Saludos.
>
> Nicolas Lubkov
> Ing. Informatica de gestion
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Django Improper Configuration

2011-01-24 Thread Kelly Nicholes
I think I had this error too when I was cloning a repo from WebFaction
to use on my local dev machine.  I ended up having to replace
WebFaction's manage.py with the one from Django.  Let me know if it
works for you!  I wish I could explain why.  Can't.

On Jan 23, 8:55 pm, Graham Dumpleton 
wrote:
> Are you saying that those two print statements you were told to add are not
> causing anything additional to be displayed on the screen when you run both
> runserver and syncdb?
>
> This is why I asked you to provide the output again. You may not understand
> what we are looking for. Don't care about what the error is at the point but
> the information that those print statements should have output.
>
> Graham
>
>
>
>
>
>
>
> On Monday, January 24, 2011 2:48:50 PM UTC+11, Kimberly wrote:
>
> > I've provided the full errors in the post, it is there. ( same errors as
> > I've faced prior to adding the print __file__ and 'DATABASES', DATABASES) as
> > I'm encountering the same after I've copied and paste the print inside the
> > settings.py file at the end)
>
> > On Sun, Jan 23, 2011 at 9:40 PM, Graham Dumpleton 
> > wrote:
>
> >> That is two underscores, followed by 'file' followed by two underscores.
> >> Not just a single underscore.
>
> >> Please try and cut and paste out we give to use and vice versa. In other
> >> words, provide complete output showing full errors and tracebacks. Such
> >> information may be meaningful to use even if you think it isn't.
>
> >> Graham
>
> >> On Monday, January 24, 2011 2:35:06 PM UTC+11, Kimberly wrote:
>
> >>> it says that the _file_ is not defined.
>
> >>> On Sun, Jan 23, 2011 at 9:28 PM, Graham Dumpleton 
> >>> wrote:
>
>  On Monday, January 24, 2011 2:19:09 PM UTC+11, Steven Elliott Jr wrote:
>
> > Copy and Paste the following to replace your entire DATABASES tuple:
>
> > DATABASES = {
> >     'default': {
> >         'ENGINE': 'django.db.backends.sqlite3',
> >         'NAME': 'database.db',                    
> >         'USER': '',                      
> >         'PASSWORD': '',                  
> >         'HOST': '',                      
> >         'PORT': '',                      
> >     }
> > }
>
> > it looks like in your configuration you are also missing a comma after
> > the name of the database. Remember you must include that comma because 
> > this
> > is a tuple.
>
>  That was already pointed out to them.
>
>  The lack of a comma should have resulted in a syntax error, which makes
>  me believe, unless they modified the content before posting, that they 
>  may
>  be modifying a different file to what is being read.
>
>  I would like to see them, instead of changing DATABASES yet again, is to
>  add at the very end of their settings.py file, the lines:
>
>    print __file__
>    print 'DATABASES', DATABASES
>
>  This will prove two things. First that the file is being read as the
>  output from this should show on stdout when running runserver or syncdb.
>  Second, will show what Python is seeing DATABASES as being set to.
>
>  if it doesn't show, then wrong file. If shows, but is different to what
>  they believe they are setting it to, they could have multiple DATABASES
>  entries in file.
>
>  Graham
>
>   --
>  You received this message because you are subscribed to the Google
>  Groups "Django users" group.
>  To post to this group, send email to djan...@googlegroups.com.
>  To unsubscribe from this group, send email to
>  django-...@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...@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 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.



Constants in model, that point to certain objects in database

2011-01-24 Thread Filip Gruszczyński
I would like to achieve something like this:

class MyModel(models.Model):
 

CONST = MyModel.objects.get(id=1)

The problem is, that during class definition _mymodel table
might not exist or there might not be those objects there.

Of course I could do it like this:

class MyModel(models.Model):

@classmethod
def CONST1(Class):
return Class.objects.get(id=1)

but I don't like it, because I would have to call a constant, rather
than just access it and it is against our coding conventions. I though
about having a metaclass, that would add __getattr__ to MyModel, that
would be used during run time, but Model subclasses can't have own
metaclass.

So, is there any other way?

What I am thinking, is attaching those constants after table are
created _and_ fixtures are loaded. Is there any hook in django, that I
could use?

-- 
Filip Gruszczyński

-- 
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 - Verfication of runserver vs browser

2011-01-24 Thread Bill Freeman
Is the browser running on the same box as djanog?  By default, the
development server won't answer requests that don't come from the
local box.  If this is the issue, try:

   python manage.py runserver 0.0.0.0:8000

This tells the development server to accept requests from anywhere.

It is also possible that you have firewall settings that prevent you
from accessing the box.

Bill

On Mon, Jan 24, 2011 at 1:21 AM, Shawn Milochik  wrote:
> If you've been messing around quite a bit trying to fix other issues, the 
> port may be held up by a zombie process or something.
>
> Try rebooting. If that doesn't work, see if the command line where runserver 
> is running displays any message.
>
> Shawn
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-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.



Subutai Corporation seeks Lead Server Programmer in San Francisco

2011-01-24 Thread Jeremy Bornstein
 Greetings all!

Subutai Corporation is looking for a Lead Server Programmer for its PULP
platform. PULP is an end-to-end system for the creation and publishing
of social-enabled content across a wide variety of connected platforms.
PULP supports collaborative professional and community authoring of a
wide variety of content types (prose, images, video, games, etc.), by
providing workflow, collaboration, canon & arc management, asset
management, and community feedback services. PULP also serves as a
multiplatform CMS and integrated commerce system, allowing for content,
commerce and community services to be automatically optimized to a wide
and increasing number of end-point devices, and for the user experience
to be seamlessly integrated across heterogeneous touch points. The first
implementation of PULP can be seen in Neal Stephenson's & Greg
Bear's /The Mongoliad/ at http://www.mongoliad.com/.

The PULP Lead Server Programmer will be responsible for the evolution of
the PULP services codebase, and will work closely with the PULP product
manager and engineers to develop new capabilities and to refine existing
features. The successful candidate will be expert in:

* Getting things done, as a general skillset
* Practical software engineering, with a bonus for facility in
  Python and Django
* Developing and launching web-based applications
* Agile development methodologies
* Wrangling third-party APIs
* Coding for and measuring/optimizing performance
* Communicating with non-engineers when useful
* Release management
* Design and use of relational databases

Our ideal candidate will have 5+ years of solid experience in software
engineering for large-scale consumer web applications, and will have
experience with web CMS and community systems. Affinity for a startup
environment and a passion for computer programming are essential. This
is a full-time position in San Francisco.

Subutai Corporation is an employee-owned company, founded by
best-selling author Neal Stephenson and a team of technology startup and
content industry veterans, and backed by some of the world's most
successful entrepreneurs. We are based in Seattle and San Francisco. We
offer competitive compensation and benefits, and the chance to help
build the future of publishing alongside some of industry's leading
visionaries and most accomplished technologists. Please send resumes and
brief cover notes to j...@subutai.mn .


(This posting may also be found at http://subutai.mn/jobs.html.  Feel
free to forward to appropriate venues.)

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



hidden widget in form still appears.

2011-01-24 Thread shofty
I realise i might be touching on something old here since i think i've
found a bug submission on it, but that only talks about in the
admin...


so this is my declaration of a form field...

fields = { 'xxx_venue' :
forms.CharField(widget=forms.HiddenInput(attrs={'class':'hideme','value':this_venue}),
label=""),

and used a hiddeninput to hide it, but i still get the label. so i've
hidden the label by blanking it and i still get the colon between the
empty label and the hidden input.

the class hideme that i've applied only applies to the input, not to
the label or the colon between the two.

is this actually a bug?
is this the same as http://code.djangoproject.com/ticket/11277?
is there an obvious way round this which doesn't involve using jquery?

-- 
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: hidden widget in form still appears.

2011-01-24 Thread Daniel Roseman
On Monday, January 24, 2011 5:06:53 PM UTC, shofty wrote:
>
> I realise i might be touching on something old here since i think i've 
> found a bug submission on it, but that only talks about in the 
> admin... 
>
>
> so this is my declaration of a form field... 
>
> fields = { 'xxx_venue' : 
> forms.CharField(widget=forms.HiddenInput(attrs={'class':'hideme','value':this_venue}),
>  
>
> label=""), 
>
> and used a hiddeninput to hide it, but i still get the label. so i've 
> hidden the label by blanking it and i still get the colon between the 
> empty label and the hidden input. 
>
> the class hideme that i've applied only applies to the input, not to 
> the label or the colon between the two. 
>
> is this actually a bug? 
> is this the same as http://code.djangoproject.com/ticket/11277? 
> is there an obvious way round this which doesn't involve using jquery?


How are you outputting the field?
--
DR. 

-- 
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: Constants in model, that point to certain objects in database

2011-01-24 Thread bruno desthuilliers


On 24 jan, 16:43, Filip Gruszczyński  wrote:
> I would like to achieve something like this:
>
> class MyModel(models.Model):
>      
>
>     CONST = MyModel.objects.get(id=1)
>
> The problem is, that during class definition _mymodel table
> might not exist or there might not be those objects there.

FWIW, by that time, the MyModel class doesn't even exists yet - you
can't refer to the current class object inside a 'class' statement
body.

> Of course I could do it like this:
>
> class MyModel(models.Model):
>
>     @classmethod
>     def CONST1(Class):
>         return Class.objects.get(id=1)
>
> but I don't like it, because I would have to call a constant, rather
> than just access it and it is against our coding conventions.

You could write a custom descriptor then. But the whole idea of a
class-level pseudo-constant pointing to a model instance still looks
rather backward to me.

Oh, and while were at it: the Python standard for the current class
param name in a classmethod is 'cls', not 'Class' ;)



 I though
> about having a metaclass, that would add __getattr__ to MyModel, that
> would be used during run time, but Model subclasses can't have own
> metaclass.


Yes they do - as long as their metaclass derives from the appropriate
metaclass (ModelBase IIRC but better to check it out).

-- 
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 Improper Configuration

2011-01-24 Thread Mark Penix
This might be a stupid question but did you install the sqlite package?

On Mon, Jan 24, 2011 at 9:39 AM, Kelly Nicholes wrote:

> I think I had this error too when I was cloning a repo from WebFaction
> to use on my local dev machine.  I ended up having to replace
> WebFaction's manage.py with the one from Django.  Let me know if it
> works for you!  I wish I could explain why.  Can't.
>
> On Jan 23, 8:55 pm, Graham Dumpleton 
> wrote:
>  > Are you saying that those two print statements you were told to add are
> not
> > causing anything additional to be displayed on the screen when you run
> both
> > runserver and syncdb?
> >
> > This is why I asked you to provide the output again. You may not
> understand
> > what we are looking for. Don't care about what the error is at the point
> but
> > the information that those print statements should have output.
> >
> > Graham
> >
> >
> >
> >
> >
> >
> >
> > On Monday, January 24, 2011 2:48:50 PM UTC+11, Kimberly wrote:
> >
> > > I've provided the full errors in the post, it is there. ( same errors
> as
> > > I've faced prior to adding the print __file__ and 'DATABASES',
> DATABASES) as
> > > I'm encountering the same after I've copied and paste the print inside
> the
> > > settings.py file at the end)
> >
> > > On Sun, Jan 23, 2011 at 9:40 PM, Graham Dumpleton <
> graham.d...@gmail.com>wrote:
> >
> > >> That is two underscores, followed by 'file' followed by two
> underscores.
> > >> Not just a single underscore.
> >
> > >> Please try and cut and paste out we give to use and vice versa. In
> other
> > >> words, provide complete output showing full errors and tracebacks.
> Such
> > >> information may be meaningful to use even if you think it isn't.
> >
> > >> Graham
> >
> > >> On Monday, January 24, 2011 2:35:06 PM UTC+11, Kimberly wrote:
> >
> > >>> it says that the _file_ is not defined.
> >
> > >>> On Sun, Jan 23, 2011 at 9:28 PM, Graham Dumpleton <
> graha...@gmail.com>wrote:
> >
> >  On Monday, January 24, 2011 2:19:09 PM UTC+11, Steven Elliott Jr
> wrote:
> >
> > > Copy and Paste the following to replace your entire DATABASES
> tuple:
> >
> > > DATABASES = {
> > > 'default': {
> > > 'ENGINE': 'django.db.backends.sqlite3',
> > > 'NAME': 'database.db',
> > > 'USER': '',
> > > 'PASSWORD': '',
> > > 'HOST': '',
> > > 'PORT': '',
> > > }
> > > }
> >
> > > it looks like in your configuration you are also missing a comma
> after
> > > the name of the database. Remember you must include that comma
> because this
> > > is a tuple.
> >
> >  That was already pointed out to them.
> >
> >  The lack of a comma should have resulted in a syntax error, which
> makes
> >  me believe, unless they modified the content before posting, that
> they may
> >  be modifying a different file to what is being read.
> >
> >  I would like to see them, instead of changing DATABASES yet again,
> is to
> >  add at the very end of their settings.py file, the lines:
> >
> >    print __file__
> >    print 'DATABASES', DATABASES
> >
> >  This will prove two things. First that the file is being read as the
> >  output from this should show on stdout when running runserver or
> syncdb.
> >  Second, will show what Python is seeing DATABASES as being set to.
> >
> >  if it doesn't show, then wrong file. If shows, but is different to
> what
> >  they believe they are setting it to, they could have multiple
> DATABASES
> >  entries in file.
> >
> >  Graham
> >
> >   --
> >  You received this message because you are subscribed to the Google
> >  Groups "Django users" group.
> >  To post to this group, send email to djan...@googlegroups.com.
> >  To unsubscribe from this group, send email to
> >  django-...@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...@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 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.
>
>


-- 
*Mark Penix*
*Independent Team Beachbody Fitness Coach*
http://www.markpenix.com
http://www.beachbodycoach.com/MarkP90X
http://www.myshakeology.com/MarkP90X
*402-321-8996*

-- 
You received this

Re: local variable 'qft' referenced before assignment

2011-01-24 Thread Trevor Stanley

Bruno

I will take your advice and seek out some Python literature.  I did run 
through an online Python tutorial about a year ago.  I should probably 
go through it again as I may understand it more now.


Thanks, even though your delivery is rather blunt - Trevor

bruno desthuilliers wrote:

On 23 jan, 23:20, Trevor Stanley  wrote:
  

Thanks Bruno for the critique and you are right I don't know what I'm
doing and I am rather learning by accident.  I am not a programmer and
don't profess to be one(yet).  I have built the apps in the excellent
book, Practical Django Projects and I have also worked through, The
Definitive Guide to Django which I have by my side.  I also have Pro
Django on stand-by.  I know it may take me some time to get where I need
to be in order to successfully write fluent Django code



(snip)

  

If you have any tips as to where you think I may be able to obtain some
good tuition I would be pleased to hear about it.



Well, the first point is that you're not writing "django" code but
Python. Django is a framework, but the language is Python, and you
have to learn the language itself to be able to properly use the
framework. I strongly suggest you spend some times doing the official
Python tutorial before anything else. The Python usenet group (that
you can join thru google groups) is a very newbie friendly place (at
least by usenet standards) so don't be afraid to post python related
questions there.

wrt/ programming by accident, I guess we all (well, most of us) start
this way, then realize it's not the best thing to do. One of the nice
points with Python is the interactive shell that let you experiment
with the language and most libs / frameworks / whatever, so you don't
have to write hundreds lines of code just to find out you got it all
wrong - just read the doc (first, mandatory step), then fire the
interpreter and try out "live".

Once you get a better grasp of the language itself, you have to have
at least a basic understanding of what the Django framework try to
"abstract" : relational databases (IOW: SQL) and the HTTP protocol. If
you don't understand what Django is doing for you, you'll never be
able to use it properly.

My 2 cents...

  


--
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 - Verfication of runserver vs browser

2011-01-24 Thread Kimberly Harvey
response to messages:

I am using the Django inside the Linux-Debian on my windows 7 machine. This
is what happen when I opened the terminal in the Django..
command: python manage.py runserver
It runs fine... 0 errors.
It shows me the url which is http://..  then I went to the browser on
the Djano which is run on the linux-Debian virtual box, and copied the url
that the terminal stated there were no errors. Once I did that, it  says it
refused connection.


Answer to Bill Freeman: Yes the broswer running on the same box as django (
Like I've mentioned above to another post). I will do what you suggest which
is to run the server 0.0.0.0:8000.
I don't understand on how I have a firewall when the terminal stated that
there are 0 errors after I ran the manage.py runserver.



On Mon, Jan 24, 2011 at 10:24 AM, Bill Freeman  wrote:

> Is the browser running on the same box as djanog?  By default, the
> development server won't answer requests that don't come from the
> local box.  If this is the issue, try:
>
>   python manage.py runserver 0.0.0.0:8000
>
> This tells the development server to accept requests from anywhere.
>
> It is also possible that you have firewall settings that prevent you
> from accessing the box.
>
> Bill
>
> On Mon, Jan 24, 2011 at 1:21 AM, Shawn Milochik 
> wrote:
> > If you've been messing around quite a bit trying to fix other issues, the
> port may be held up by a zombie process or something.
> >
> > Try rebooting. If that doesn't work, see if the command line where
> runserver is running displays any message.
> >
> > Shawn
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-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.



Re: Django Improper Configuration

2011-01-24 Thread Kimberly Harvey
Karen,

  It worked after I used the mv command to move the settings.py
settings.py.break and then did another move where from settings.py.break to
settings.py, then I ran the server by using the manage.py syncdb. I do not
understand why that even worked ( I didn't want to use the settings.py.break
because the Django originally used the settings.py), so that why I did the
move 2 times. Originally before the settings.py.break came into play, there
was another settings.py elsewhere in the file which create some corruption (
hence, problem with configuration -- DATABASE ENGINE was not set).
Therefore, to remove the settings.py from another location, I had to do what
I did above. Oddly, it works.

On Mon, Jan 24, 2011 at 12:29 PM, Mark Penix  wrote:

> This might be a stupid question but did you install the sqlite package?
>
>
> On Mon, Jan 24, 2011 at 9:39 AM, Kelly Nicholes wrote:
>
>> I think I had this error too when I was cloning a repo from WebFaction
>> to use on my local dev machine.  I ended up having to replace
>> WebFaction's manage.py with the one from Django.  Let me know if it
>> works for you!  I wish I could explain why.  Can't.
>>
>> On Jan 23, 8:55 pm, Graham Dumpleton 
>> wrote:
>>  > Are you saying that those two print statements you were told to add
>> are not
>> > causing anything additional to be displayed on the screen when you run
>> both
>> > runserver and syncdb?
>> >
>> > This is why I asked you to provide the output again. You may not
>> understand
>> > what we are looking for. Don't care about what the error is at the point
>> but
>> > the information that those print statements should have output.
>> >
>> > Graham
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Monday, January 24, 2011 2:48:50 PM UTC+11, Kimberly wrote:
>> >
>> > > I've provided the full errors in the post, it is there. ( same errors
>> as
>> > > I've faced prior to adding the print __file__ and 'DATABASES',
>> DATABASES) as
>> > > I'm encountering the same after I've copied and paste the print inside
>> the
>> > > settings.py file at the end)
>> >
>> > > On Sun, Jan 23, 2011 at 9:40 PM, Graham Dumpleton <
>> graham.d...@gmail.com>wrote:
>> >
>> > >> That is two underscores, followed by 'file' followed by two
>> underscores.
>> > >> Not just a single underscore.
>> >
>> > >> Please try and cut and paste out we give to use and vice versa. In
>> other
>> > >> words, provide complete output showing full errors and tracebacks.
>> Such
>> > >> information may be meaningful to use even if you think it isn't.
>> >
>> > >> Graham
>> >
>> > >> On Monday, January 24, 2011 2:35:06 PM UTC+11, Kimberly wrote:
>> >
>> > >>> it says that the _file_ is not defined.
>> >
>> > >>> On Sun, Jan 23, 2011 at 9:28 PM, Graham Dumpleton <
>> graha...@gmail.com>wrote:
>> >
>> >  On Monday, January 24, 2011 2:19:09 PM UTC+11, Steven Elliott Jr
>> wrote:
>> >
>> > > Copy and Paste the following to replace your entire DATABASES
>> tuple:
>> >
>> > > DATABASES = {
>> > > 'default': {
>> > > 'ENGINE': 'django.db.backends.sqlite3',
>> > > 'NAME': 'database.db',
>> > > 'USER': '',
>> > > 'PASSWORD': '',
>> > > 'HOST': '',
>> > > 'PORT': '',
>> > > }
>> > > }
>> >
>> > > it looks like in your configuration you are also missing a comma
>> after
>> > > the name of the database. Remember you must include that comma
>> because this
>> > > is a tuple.
>> >
>> >  That was already pointed out to them.
>> >
>> >  The lack of a comma should have resulted in a syntax error, which
>> makes
>> >  me believe, unless they modified the content before posting, that
>> they may
>> >  be modifying a different file to what is being read.
>> >
>> >  I would like to see them, instead of changing DATABASES yet again,
>> is to
>> >  add at the very end of their settings.py file, the lines:
>> >
>> >    print __file__
>> >    print 'DATABASES', DATABASES
>> >
>> >  This will prove two things. First that the file is being read as
>> the
>> >  output from this should show on stdout when running runserver or
>> syncdb.
>> >  Second, will show what Python is seeing DATABASES as being set to.
>> >
>> >  if it doesn't show, then wrong file. If shows, but is different to
>> what
>> >  they believe they are setting it to, they could have multiple
>> DATABASES
>> >  entries in file.
>> >
>> >  Graham
>> >
>> >   --
>> >  You received this message because you are subscribed to the Google
>> >  Groups "Django users" group.
>> >  To post to this group, send email to djan...@googlegroups.com.
>> >  To unsubscribe from this group, send email to
>> >  django-...@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
>> Grou

Re: Django Improper Configuration

2011-01-24 Thread Kimberly Harvey
yes the sqlite package is installed. I installed the Django and the python,
and I test it to ensure it is there and it is.

On Mon, Jan 24, 2011 at 12:48 PM, Kimberly Harvey wrote:

> Karen,
>
>   It worked after I used the mv command to move the settings.py
> settings.py.break and then did another move where from settings.py.break to
> settings.py, then I ran the server by using the manage.py syncdb. I do not
> understand why that even worked ( I didn't want to use the settings.py.break
> because the Django originally used the settings.py), so that why I did the
> move 2 times. Originally before the settings.py.break came into play, there
> was another settings.py elsewhere in the file which create some corruption (
> hence, problem with configuration -- DATABASE ENGINE was not set).
> Therefore, to remove the settings.py from another location, I had to do what
> I did above. Oddly, it works.
>
> On Mon, Jan 24, 2011 at 12:29 PM, Mark Penix  wrote:
>
>> This might be a stupid question but did you install the sqlite package?
>>
>>
>> On Mon, Jan 24, 2011 at 9:39 AM, Kelly Nicholes 
>> wrote:
>>
>>> I think I had this error too when I was cloning a repo from WebFaction
>>> to use on my local dev machine.  I ended up having to replace
>>> WebFaction's manage.py with the one from Django.  Let me know if it
>>> works for you!  I wish I could explain why.  Can't.
>>>
>>> On Jan 23, 8:55 pm, Graham Dumpleton 
>>> wrote:
>>>  > Are you saying that those two print statements you were told to add
>>> are not
>>> > causing anything additional to be displayed on the screen when you run
>>> both
>>> > runserver and syncdb?
>>> >
>>> > This is why I asked you to provide the output again. You may not
>>> understand
>>> > what we are looking for. Don't care about what the error is at the
>>> point but
>>> > the information that those print statements should have output.
>>> >
>>> > Graham
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > On Monday, January 24, 2011 2:48:50 PM UTC+11, Kimberly wrote:
>>> >
>>> > > I've provided the full errors in the post, it is there. ( same errors
>>> as
>>> > > I've faced prior to adding the print __file__ and 'DATABASES',
>>> DATABASES) as
>>> > > I'm encountering the same after I've copied and paste the print
>>> inside the
>>> > > settings.py file at the end)
>>> >
>>> > > On Sun, Jan 23, 2011 at 9:40 PM, Graham Dumpleton <
>>> graham.d...@gmail.com>wrote:
>>> >
>>> > >> That is two underscores, followed by 'file' followed by two
>>> underscores.
>>> > >> Not just a single underscore.
>>> >
>>> > >> Please try and cut and paste out we give to use and vice versa. In
>>> other
>>> > >> words, provide complete output showing full errors and tracebacks.
>>> Such
>>> > >> information may be meaningful to use even if you think it isn't.
>>> >
>>> > >> Graham
>>> >
>>> > >> On Monday, January 24, 2011 2:35:06 PM UTC+11, Kimberly wrote:
>>> >
>>> > >>> it says that the _file_ is not defined.
>>> >
>>> > >>> On Sun, Jan 23, 2011 at 9:28 PM, Graham Dumpleton <
>>> graha...@gmail.com>wrote:
>>> >
>>> >  On Monday, January 24, 2011 2:19:09 PM UTC+11, Steven Elliott Jr
>>> wrote:
>>> >
>>> > > Copy and Paste the following to replace your entire DATABASES
>>> tuple:
>>> >
>>> > > DATABASES = {
>>> > > 'default': {
>>> > > 'ENGINE': 'django.db.backends.sqlite3',
>>> > > 'NAME': 'database.db',
>>> > > 'USER': '',
>>> > > 'PASSWORD': '',
>>> > > 'HOST': '',
>>> > > 'PORT': '',
>>> > > }
>>> > > }
>>> >
>>> > > it looks like in your configuration you are also missing a comma
>>> after
>>> > > the name of the database. Remember you must include that comma
>>> because this
>>> > > is a tuple.
>>> >
>>> >  That was already pointed out to them.
>>> >
>>> >  The lack of a comma should have resulted in a syntax error, which
>>> makes
>>> >  me believe, unless they modified the content before posting, that
>>> they may
>>> >  be modifying a different file to what is being read.
>>> >
>>> >  I would like to see them, instead of changing DATABASES yet again,
>>> is to
>>> >  add at the very end of their settings.py file, the lines:
>>> >
>>> >    print __file__
>>> >    print 'DATABASES', DATABASES
>>> >
>>> >  This will prove two things. First that the file is being read as
>>> the
>>> >  output from this should show on stdout when running runserver or
>>> syncdb.
>>> >  Second, will show what Python is seeing DATABASES as being set to.
>>> >
>>> >  if it doesn't show, then wrong file. If shows, but is different to
>>> what
>>> >  they believe they are setting it to, they could have multiple
>>> DATABASES
>>> >  entries in file.
>>> >
>>> >  Graham
>>> >
>>> >   --
>>> >  You received this message because you are subscribed to the Google
>>> >  Groups "Django users" group.
>>> >  To post to this group, send email to d

Re: Django - Verfication of runserver vs browser

2011-01-24 Thread Javier Guerra Giraldez
On Mon, Jan 24, 2011 at 1:43 PM, Kimberly Harvey  wrote:
> I am using the Django inside the Linux-Debian on my windows 7 machine.

do you run your browser in Windows or Linux?

if it's on windows, then accessing the dev-server on the Linux virtual
machine is just like going to any other machine; you can't use
127.0.0.1

ah, and remember that your VM can't use the same IP# as your windows host

-- 
Javier

-- 
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 - Verfication of runserver vs browser

2011-01-24 Thread Kimberly Harvey
I ran the browser in the linux.

On Mon, Jan 24, 2011 at 12:57 PM, Javier Guerra Giraldez  wrote:

> On Mon, Jan 24, 2011 at 1:43 PM, Kimberly Harvey 
> wrote:
> > I am using the Django inside the Linux-Debian on my windows 7 machine.
>
> do you run your browser in Windows or Linux?
>
> if it's on windows, then accessing the dev-server on the Linux virtual
> machine is just like going to any other machine; you can't use
> 127.0.0.1
>
> ah, and remember that your VM can't use the same IP# as your windows host
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django - Verfication of runserver vs browser

2011-01-24 Thread Joel Goldstick
On Mon, Jan 24, 2011 at 2:05 PM, Kimberly Harvey wrote:

> I ran the browser in the linux.
>
>
> On Mon, Jan 24, 2011 at 12:57 PM, Javier Guerra Giraldez <
> jav...@guerrag.com> wrote:
>
>> On Mon, Jan 24, 2011 at 1:43 PM, Kimberly Harvey 
>> wrote:
>> > I am using the Django inside the Linux-Debian on my windows 7 machine.
>>
>> do you run your browser in Windows or Linux?
>>
>> if it's on windows, then accessing the dev-server on the Linux virtual
>> machine is just like going to any other machine; you can't use
>> 127.0.0.1
>>
>> ah, and remember that your VM can't use the same IP# as your windows host
>>
>> --
>> Javier
>>
>> --
>> 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.
>

So, I'm not sure how far along you are with your django project.  I suggest
you follow the django tutorial from the start.  Maybe its best to abandon
your present project for the time being and start another with the
tutorial.  Within about 10 minutes you will get to the point of seeing a
screen in your browser that says 'It works!' along with some other
instructions.  If you get that far, you know that you can create a django
project and you know that the steps you are using to see it in your browser
(all in your debian environment) are correct.  Doing this exercise might
help you discover if you have misstepped somewhere along the way on your
project


-- 
Joel Goldstick

-- 
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 - Verfication of runserver vs browser

2011-01-24 Thread Steven Elliott Jr
Have you tried running it on a different port? Can you post the actual error 
message you get?

-Steven Elliott Jr

On Jan 24, 2011, at 2:05 PM, Kimberly Harvey  wrote:

> I ran the browser in the linux.
> 
> On Mon, Jan 24, 2011 at 12:57 PM, Javier Guerra Giraldez  
> wrote:
> On Mon, Jan 24, 2011 at 1:43 PM, Kimberly Harvey  wrote:
> > I am using the Django inside the Linux-Debian on my windows 7 machine.
> 
> do you run your browser in Windows or Linux?
> 
> if it's on windows, then accessing the dev-server on the Linux virtual
> machine is just like going to any other machine; you can't use
> 127.0.0.1
> 
> ah, and remember that your VM can't use the same IP# as your windows host
> 
> --
> Javier
> 
> --
> 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.



Re: Django - Verfication of runserver vs browser

2011-01-24 Thread Kimberly Harvey
I gotten far enough to where I was able to runserver and it detects NO
errors, and that I was able to create my superusers after I've syncdb the
manage.py file. On screen:  " You just installed Django's auth system, which
means you dont have any superusers defined, would you like to create on?"
Once i did all of that, and reun the server, it keeps saying there were no
errors. Yes, I checked the browser ON linux.

I am not on my personal computer right now to post what I am seeing. When I
get home, I will copy/paste exactly what it shows on the screen.

On Mon, Jan 24, 2011 at 1:15 PM, Steven Elliott Jr  wrote:

> Have you tried running it on a different port? Can you post the actual
> error message you get?
>
> -Steven Elliott Jr
>
> On Jan 24, 2011, at 2:05 PM, Kimberly Harvey  wrote:
>
> I ran the browser in the linux.
>
> On Mon, Jan 24, 2011 at 12:57 PM, Javier Guerra Giraldez <
> jav...@guerrag.com> wrote:
>
>> On Mon, Jan 24, 2011 at 1:43 PM, Kimberly Harvey < 
>> kharve...@gmail.com> wrote:
>> > I am using the Django inside the Linux-Debian on my windows 7 machine.
>>
>> do you run your browser in Windows or Linux?
>>
>> if it's on windows, then accessing the dev-server on the Linux virtual
>> machine is just like going to any other machine; you can't use
>> 127.0.0.1
>>
>> ah, and remember that your VM can't use the same IP# as your windows host
>>
>> --
>> Javier
>>
>> --
>> 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.
>

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



remove items as they are assigned

2011-01-24 Thread arlen nascimento
Hi all,
i'm trying to do a simple thing, but it seems not so simple in django.

I have the following models

 class Monitor(models.Model):
  id ...
  name ...
  address = foreignkey(MonitorAddress)

class MonitorAddress(models.Model):
  address = CharField()

what i want to do is as long as i assign a name to a monitor in the
admin add page, MonitorAddress show me only the non-assigned addresses
in the combobox

i've already tried with forms and inserting a raw sql query in
models.py and forms.py, but it looks like these files are loaded only
once

-- 
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: local variable 'qft' referenced before assignment

2011-01-24 Thread Rainy
On Jan 24, 1:46 pm, Trevor Stanley  wrote:
> Bruno
>
> I will take your advice and seek out some Python literature.  I did run
> through an online Python tutorial about a year ago.  I should probably
> go through it again as I may understand it more now.
>
> Thanks, even though your delivery is rather blunt - Trevor
>

It seems like the problem is that you're trying to do
fairly complex things in django when you don't
have good understanding of python. Simply
reading python tutorial will help but probably
won't be enough, I would recommend doing a
few small, simple projects in plain python to get
a good practical knowledge of how functions,
lists and dictionaries work.

In the above code, you apparently thought that
in line qft=ft(sum('percentage')) ,
percentage field will somehow be extracted from
ft and then summed. You should understand that
the line is equivalent to
mysum = sum('percentage')
qft = ft(mysum)

Then you'd certainly see that sum('percentage')
is trying to make a sum out of the string. Again,
this is a tidbit of basic python knowledge that
you have to have a perfect grip on before
doing the type of project that you have here.

It's ok to try things and run into errors. But you
have to have a better grasp on fundamentals
when you do that. In the above example, adding
a sum() call inside a call to ft and giving it a field
name as argument is as likely to work as doing

ft('percentage') # please sum

or

ft{'percentage':sum}

or a million of other things that won't work and
result in confusing errors.

Walk before you run and all that..  HTH, -ak

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



size of an image

2011-01-24 Thread refreegrata
hello list, I have a question. How can I get the width and the size of
an image previously saved?. This is , because I need to generate a
report with reportlab, and I must to resize the image, but I need the
original size to keep the scale.

Thanks and sorry for my bad english

-- 
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: size of an image

2011-01-24 Thread Shawn Milochik
Try this. PIL is required anyway for the Django image field. Perhaps there's 
something
built into Django to get this info, but this article will give you a more 
generic and widely useful understanding.

http://www.blog.pythonlibrary.org/2010/03/28/getting-photo-metadata-exif-using-python/

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Constants in model, that point to certain objects in database

2011-01-24 Thread Filip Gruszczyński
> FWIW, by that time, the MyModel class doesn't even exists yet - you
> can't refer to the current class object inside a 'class' statement
> body.

Yes, you are right. What I meant was:

class MyModel(models.Model):
 ...

MyModel.CONST = MyModel.objects.get(id=1)

> You could write a custom descriptor then. But the whole idea of a
> class-level pseudo-constant pointing to a model instance still looks
> rather backward to me.

What is a custom descriptor? I have never used it. Is it something
like a property?

> Oh, and while were at it: the Python standard for the current class
> param name in a classmethod is 'cls', not 'Class' ;)

I have seen both cls and klass in django code. I prefer mine, because
it clearly indicates, that the objects is not an instance, but a class
(and therefore type instance, right?).

> Yes they do - as long as their metaclass derives from the appropriate
> metaclass (ModelBase IIRC but better to check it out).

I'll definitely try that.

-- 
Filip Gruszczyński

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



MultipleChoiceField Edit form Error

2011-01-24 Thread geraldcor
Hello All,

I am having a problem with my MultipleChoiceField. I have my model
field, form field and choices listed below. When I select choices 1-9,
the edit form shows that these choices have been checked (i.e. save
the form, then view the form for editing again, the previously checked
check boxes are checked and this works using CheckboxSelectMultiple or
the standard Multiple Select Widget). However, when I chose choices 10
or 11 (or beyond), the list gets saved to my table field just fine
([u'1', u'3', u'11']), but when I view the form for editing, choice 11
(UK) is not checked.

It appears that when my Choice is a two digit number (in string
format) it saves just fine, but when the html is being rendered for
the form, the checked attribute is not being checked properly for the
last items.

I also tried changing choice 1 to 12 and that broke it, but then
worked when changed back to 1. Everything saves fine in the table, but
is not rendered correctly and the template tag I wrote to display the
selected choices works just fine with those higher number choices.

MODEL FIELD

targetmarkets = models.CharField(max_length=255, blank=True)

TARGETMARKETS_CHOICES = (
('1', 'Europe'),
('2', 'Asia'),
('3', 'North America'),
('4', 'South America'),
('5', 'Africa'),
('6', 'Canada'),
('7', 'USA'),
('8', 'East Europe'),
('9', 'West Europe'),
('10', 'Australasia'),
('11', 'UK'),
)

FORM FIELD

targetmarkets = forms.MultipleChoiceField(required=False,
widget=forms.CheckboxSelectMultiple, choices=TARGETMARKETS_CHOICES)

-- 
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: local variable 'qft' referenced before assignment

2011-01-24 Thread Trevor Stanley

Rainy

Yes I think you and Bruno have helped me look at it all over again and I 
will certainly get into Python so I can understand it more fully.  I 
have not ever programmed before and although I have tried to seek local 
authority courses and other types of training it seems they are not 
there.  I am self taught in all aspects of IT as I am now passed the 
half century the idea of computing was not even considered when I was at 
school!


Anyway, thank you for your comments and time.  I'm sure you will be 
hearing from me again, but I hope next time it will be about more 
pertinent issues.


Best - Trevor



Rainy wrote:

On Jan 24, 1:46 pm, Trevor Stanley  wrote:
  

Bruno

I will take your advice and seek out some Python literature.  I did run
through an online Python tutorial about a year ago.  I should probably
go through it again as I may understand it more now.

Thanks, even though your delivery is rather blunt - Trevor




It seems like the problem is that you're trying to do
fairly complex things in django when you don't
have good understanding of python. Simply
reading python tutorial will help but probably
won't be enough, I would recommend doing a
few small, simple projects in plain python to get
a good practical knowledge of how functions,
lists and dictionaries work.

In the above code, you apparently thought that
in line qft=ft(sum('percentage')) ,
percentage field will somehow be extracted from
ft and then summed. You should understand that
the line is equivalent to
mysum = sum('percentage')
qft = ft(mysum)

Then you'd certainly see that sum('percentage')
is trying to make a sum out of the string. Again,
this is a tidbit of basic python knowledge that
you have to have a perfect grip on before
doing the type of project that you have here.

It's ok to try things and run into errors. But you
have to have a better grasp on fundamentals
when you do that. In the above example, adding
a sum() call inside a call to ft and giving it a field
name as argument is as likely to work as doing

ft('percentage') # please sum

or

ft{'percentage':sum}

or a million of other things that won't work and
result in confusing errors.

Walk before you run and all that..  HTH, -ak

  


--
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: hidden widget in form still appears.

2011-01-24 Thread shofty
fair point.

i'd been reading somewhere about using :
{% for field in form %}
{{ field.errors }}
{{ field.label_tag }}:{{ field }}
{% endfor %}

to get rid of this issue.

having just swapped it back to

{{ form.as_p }}

its all working nice and cleanly. will do a little more testing.

On Jan 24, 5:20 pm, Daniel Roseman  wrote:
> On Monday, January 24, 2011 5:06:53 PM UTC, shofty wrote:
>
> > I realise i might be touching on something old here since i think i've
> > found a bug submission on it, but that only talks about in the
> > admin...
>
> > so this is my declaration of a form field...
>
> > fields = { 'xxx_venue' :
> > forms.CharField(widget=forms.HiddenInput(attrs={'class':'hideme','value':th 
> > is_venue}),
>
> > label=""),
>
> > and used a hiddeninput to hide it, but i still get the label. so i've
> > hidden the label by blanking it and i still get the colon between the
> > empty label and the hidden input.
>
> > the class hideme that i've applied only applies to the input, not to
> > the label or the colon between the two.
>
> > is this actually a bug?
> > is this the same ashttp://code.djangoproject.com/ticket/11277?
> > is there an obvious way round this which doesn't involve using jquery?
>
> How are you outputting the field?
> --
> DR.

-- 
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 multidatabase using mptt and treebeard

2011-01-24 Thread jk
Hi,

I'm trying unsuccessfully to load data in a django multi-database
environment.
I try to store some data as tree. I used django-mptt and django-
treebeard and obtain same results.

In my settings.py, I have 2 databases:
- 'default' database with sqlite3;
- 'A_Africa_Branch_01' as second database with postgresql.

To be complete:
- Before switching to postgresql, I ran 2 sqlite3 databases and got
same results;
- I wrote a router and it seems to work fine;
- Using only one database ('default'), I succeed to load all my data.

I import data to the table with a file: fill_up_branch_mptt .py.


Part of the file is:

get = lambda node_id:
BranchLocation.objects.using('A_Africa_Branch_01').get(pk=node_id)

root = BranchLocation.add_root(branch_location='A_Africa_Branch_01',
identity=)
node = get(root.id).add_child(branch_location='Region_01',
identity=1121)

get(node.id).add_child(branch_location='Area_01', identity=1777)
get(node.id).add_child(branch_location='Area_02', identity=1778)
# File continue here


When I use 2 databases: “DatabaseError: no such table:
branch_branchlocation”.
But, the table exists and the two first lines of data are recorded in
it.

Recorded information are:
row_1(root): branch_location='A_Africa_Branch_01', identity=
row_2(node): branch_location='Region_01', identity=1121

Not recorded information are: all node children.


and Traceback is:

jk@cc tree$ ./manage.py shell
Python 2.7 (r27:82500, Sep 16 2010, 18:03:06)
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
(InteractiveConsole)
>>> import fill_up_branch_mptt
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/jk/eclipse/tree/tree/fill_up_branch_mptt.py", line 63,
in 
node = get(root.id).add_child(branch_location='Region_01',
identity=1121)
  File "/usr/lib/python2.7/site-packages/django_treebeard-1.61-
py2.7.egg/treebeard/mp_tree.py", line 538, in add_child
cursor.execute(sql, [self.path])
  File "/usr/lib/python2.7/site-packages/django/db/backends/util.py",
line 15, in execute
return self.cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/
base.py", line 200, in execute
return Database.Cursor.execute(self, query, params)
DatabaseError: no such table: branch_branchlocation
>>>

I used django-mptt for the save() method with
save(using='A_Africa_Branch_01') and got the same Traceback.
Reading last line of traceback there is  “django/db/backends/sqlite3/
base.py”.

Someone know this problem or where I can find documentation for using
mptt or treebeard inside a multi-database environment ?

Thanks in advance for your answers.

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



modelformset not iterable

2011-01-24 Thread Axel Bock
Hello all,

I am trying to implement something quite simple, in my eyes. But it does not
work at all ... . Basically, I create a modelformset_factory with a model of
mine, and pass the instantiated modelformset to my template to render. And I
get the message *Caught TypeError while rendering: 'LegFormFormSet' object
is not iterable ...* (note the *FormForm*-part in the error message? it
should be one "*Form*" only ... shouldn't it?)

The code looks like this:
def addlegs(request, mission_id=None):
*LegFormSet* = modelformset_factory(Leg, extra=3)
if not request.method == "POST":
# if mission_id is set we're being called from another method in
here ... :)
*formset = LegFormSet(queryset=Leg.objects.none())*
return rtr(request, 'flightlog/templates/addlegs.html', {*
"formset":formset*})
else:
return redirect("/")

and the template like this:
{% load widget_tweaks %}

{% csrf_token %}
{{ formset.management_form }}

{% for form in formset %}
{% for field in form %}
{{ field|add_class:"myclass" }}
{% endfor %}
{% endfor %}




in my eyes that's all pretty simple, but it drives me crazy right now cause
it does not work at all. in case you wonder: the management_form is rendered
correctly. The rendered code for this looks like this:




any ideas, anyone?


Thanks for any help & greetings,
Axel.

-- 
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: modelformset not iterable

2011-01-24 Thread Axel Bock
forget it. it was formset.forms ...
I *SWEAR* there is another example just with "for form in formset" ...

thanks anyway :)
Axel.



2011/1/25 Axel Bock 

> Hello all,
>
> I am trying to implement something quite simple, in my eyes. But it does
> not work at all ... . Basically, I create a modelformset_factory with a
> model of mine, and pass the instantiated modelformset to my template to
> render. And I get the message *Caught TypeError while rendering: '
> LegFormFormSet' object is not iterable ...* (note the *FormForm*-part in
> the error message? it should be one "*Form*" only ... shouldn't it?)
>
> The code looks like this:
> def addlegs(request, mission_id=None):
> *LegFormSet* = modelformset_factory(Leg, extra=3)
> if not request.method == "POST":
> # if mission_id is set we're being called from another method in
> here ... :)
> *formset = LegFormSet(queryset=Leg.objects.none())*
> return rtr(request, 'flightlog/templates/addlegs.html', {*
> "formset":formset*})
> else:
> return redirect("/")
>
> and the template like this:
> {% load widget_tweaks %}
> 
> {% csrf_token %}
> {{ formset.management_form }}
> 
> {% for form in formset %}
> {% for field in form %}
> {{ field|add_class:"myclass" }}
> {% endfor %}
> {% endfor %}
> 
> 
> 
>
> in my eyes that's all pretty simple, but it drives me crazy right now cause
> it does not work at all. in case you wonder: the management_form is rendered
> correctly. The rendered code for this looks like this:
>  id="id_form-TOTAL_FORMS"/>   name="form-INITIAL_FORMS"
>   value="0"
>   id="id_form-INITIAL_FORMS"/>
> 
>
>
> any ideas, anyone?
>
>
> Thanks for any help & greetings,
> Axel.
>

-- 
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: size of an image

2011-01-24 Thread Carlos A. Carnero Delgado
Hi,

On Mon, Jan 24, 2011 at 3:09 PM, refreegrata  wrote:
> hello list, I have a question. How can I get the width and the size of
> an image previously saved?...

is the image a field in a model? AKA, ImageField. If that's the case,
what's wrong with the width and height fields? [1]

HTH,
Carlos.

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



label when customize django form

2011-01-24 Thread John Yeukhon Wong
In forms,py, we can simple do this
e_mail = forms.EmailField(label='Your e-mail address')

this will work and be use if we use {{ form.as_table}} for example.

But if we instead use our own customization, because it's too
restricted to use the auto form render,  when it comes to labels, we
have to manually specify it
Your e-mail address

But this may looks ugly. Is there a way to load the label from
forms.py even if we are not using form.as_ ??

Thanks.

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



Re: label when customize django form

2011-01-24 Thread Michael Oberlin
One suggestion is to simply reference
YourFormName.fields['e_mail'].label in the code that renders the
template, then pass it as a variable to the template.

As an example, assuming e_mail is set up in YourFormName as below:


from django.shortcuts import render_to_response

form = YourFormName()
e_mail_label = form.fields['e_mail'].label
variables = RequestContext(request, {'form' : form})
return render_to_response('your_template_page.html', {'e_mail_label' :
e_mail_label}, context_instance=variables}


You can then slip {{ e_mail_label }} into the HTML document wherever you
need to and have it consistently match whatever you have stored in your
forms file. I.e.,

{{ e_mail_label }}

A minor improvement in the way of aesthetics, but in the way of rapid
updates to the code (same principle as CSS) it should help. No more ugly
HTML clutter!

Best of luck,
--Mick


On Mon, 2011-01-24 at 17:07 -0800, John Yeukhon Wong wrote:
> In forms,py, we can simple do this
> e_mail = forms.EmailField(label='Your e-mail address')
> 
> this will work and be use if we use {{ form.as_table}} for example.
> 
> But if we instead use our own customization, because it's too
> restricted to use the auto form render,  when it comes to labels, we
> have to manually specify it
> Your e-mail address
> 
> But this may looks ugly. Is there a way to load the label from
> forms.py even if we are not using form.as_ ??
> 
> Thanks.
> 


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



Re: label when customize django form

2011-01-24 Thread raj

Have you checked `form.email.label_tag`?

> > But this may looks ugly. Is there a way to load the label from
> > forms.py even if we are not using form.as_ ??

-- 
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: modelformset not iterable

2011-01-24 Thread Fabian Ezequiel Gallina
2011/1/24 Axel Bock :
> forget it. it was formset.forms ...
> I *SWEAR* there is another example just with "for form in formset" ...
>
> thanks anyway :)
> Axel.
>

Probably in the documentation for the development version :)


Regards,
-- 
Fabián E. Gallina
http://www.from-the-cloud.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.



Re: Django - Verfication of runserver vs browser

2011-01-24 Thread raj
If none of above seems to work, You may be using a browser like google
chrome, which by default ignores the localhost.

-- 
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: Runtime Error: maximum recursion depth exceeded while calling Python object

2011-01-24 Thread Derek
Just for the record.  This issue was not solved; appears to be
happening on a SUSE Linux Enterprise Server.  Does not happen on an
Ubuntu server (which I have switched to).  There might be some issue
with the particular version of Python that was installed on it.

On 13 January 2011 13:44, Derek  wrote:
>
> I have now installed Apache + mod_wsgi locally and run the app.  I do not get 
> the recursion error that is happening on the server.  I'd welcome any 
> suggestions as to how to go about solving this.
>
> Thanks
> Derek
>
>
> On 13 January 2011 08:48, Derek  wrote:
>>
>> Still not working, but I suspect a recent upgrade to Django 1.2.4
>> might be the cause.
>>
>> Does anyone know (or have experience) of this kind of error when
>> upgrading?
>>
>> On Jan 12, 9:38 am, Derek  wrote:
>> > Working with Django 1.2.3
>> >
>> > I had an application that was running well.  However, some recent changes
>> > (not to the models themselves) have caused the "Runtime Error: maximum
>> > recursion depth exceeded while calling Python object" to start showing up
>> > everywhere; typically in conjunction with the def __unicode__(self)
>> > function.  The only major change I have made recently to the system is the
>> > enabling of flatpages, but i cannot see that this is likely to relate to 
>> > the
>> > model's __unicode__ functions...
>> >
>> > I realize that this is a very "sloppy" error report, but I am wondering if
>> > anyone else has encountered this type of problem (code for models working
>> > and then suddenly generating numbers of the same type of error) and can 
>> > give
>> > some general pointers on how to solve this (short of ripping out all the
>> > recent changes)?
>> >
>> > Thanks
>> > Derek
>>
>> --
>> 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.



Versioned database content

2011-01-24 Thread akaariai
Hello all,

My problem is as follows: I have content (for simplicity, lets say
articles), and some content related to that (authors for the example).
I would like to add the ability for users to create versions of the
content. The procedure from user perspective is as follows: they click
a button ("create new version") and supply some details about the
update.

Now, I would like to automatically generate dual tables for articles
and content which would be versioned. That is, when users click
"create new version" my software should insert the current data into
the dual tables so that it is possible to go back to each published
version.

The problem I am facing is this: I would like to create automatically
the dual tables. I haven't thought about the schema much, but I
probably don't need anything more than the base tables + an integer
column version. Is there any relatively easy way to create the dual
tables automatically? That is, is it possible to read the models I
have currently and create the dual table without me having to copy all
the definitions. For example, given the article model:

class Author(models.Model):
name = models.TextField()

class Article(models.Model):
id = models.AutoField()
text = models.TextField()
authors = models.ManyToManyField(Author)

I would like to create automatically (in runtime or just create the
models.py file automatically running a script) the dual models:

class AuthorDual(models.Model):
name = models.TextField()
version = models.PositiveIntegerField()

class ArticleDual(models.Model):
id = models.AutoField()
text = models.TextField()
authors = models.ManyToManyField(AuthorDual)
version = models.PositiveIntegerField()

Has anybody done anything similar? Any pointers where to look for
similar code? And is this doable in sane amount of time?

Thanks in advance,
 - Anssi

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