Unable to open database file ( Asking graphite and django forum )

2012-04-05 Thread KriRad
Hi,

I have read previous mail in many forums and tried the suggestions.
The error is "pysqlite2.dbapi2.OperationalError: unable to open
database file"

Read/Write permissions are given

Command run is

sudo /usr/bin/python manage.py syncdb

settings.py is

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqllite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '/home/admin/django/db/nio.db',  #
Or path to database file if using sqlite3.
'USER': '',  # Not used with sqlite3.
'PASSWORD': '',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for
default. Not used with sqlite3.


I have 3 settings.py files

/usr/lib/pymodules/python2.7/django/conf/project_template/
settings.py:DATABASES = {
/usr/lib/pymodules/python2.6/django/conf/project_template/
settings.py:DATABASES = {
/usr/share/pyshared/django/conf/project_template/settings.py:DATABASES
= {

Some more information. I am not using python2.6 because when I type
'python' I get the following prompt.
Python 2.7.2+ (default, Oct 4 2011, 20:03:08)
[GCC 4.6.1] on linux2

I have updated both the following files.
/usr/lib/pymodules/python2.7/django/conf/project_template/settings.py
/usr/share/pyshared/django/conf/project_template/settings.py


Thanks,
Mohan

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



Re: How to add audio to a Django based webpage?

2012-04-05 Thread Homer
It played the audio automatically after I fixed the stupid space error... 
However, the area for Windows Media Player (WMP) is still a blank. If I 
right click it, I can see the menu of WMP And I want to play it when I 
click it but I cannot... That is the situation right now.

在 2012年4月4日星期三UTC-4下午9时05分07秒,Andy McKay写道:
>
> On Wed, Apr 4, 2012 at 12:50 PM, Homer  wrote:
>
> > Should I add something else so that it would work? Thanks for your help!
>
> There's nothing I've seen yet that's a Django problem. Does the
> outputted HTML look right? Does that work? If not tell us and we'll
> see if we can help you figure out how your Django templating isn't
> outputting the right value.
>
> I'll also recommend the HTML audio tag.
>
>

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



Re: How to add audio to a Django based webpage?

2012-04-05 Thread Homer
You are right... I fixed that and the webpage can play the audio 
automatically. But I want to play it when I click it. By the way, on my 
webpage, the area of Windows Media Player is just a blank... I do not know 
why. But if I right click it, I can see the menu of Windows Media Player.

在 2012年4月4日星期三UTC-4下午5时54分58秒,Joel Goldstick写道:
>
> On Wed, Apr 4, 2012 at 3:50 PM, Homer  wrote:
> > I tried to use  command in my templates directly, but it seems 
> it is
> > not working... Here is my code:
> > {% for item in ShowAudio %}
> > 
> 

Re: Comma as decimal field

2012-04-05 Thread Python_Junkie
I assume that your problem is that when the data is posted , the ORM when 
submitting it to the database throws the eror.

You need to  place the posted value into a variable and use a python 
replace statement to replace the , with a period.

Not sure what type of validation that you are using.

Putting aside any sort of validation on the number.

new_number=request.post(variable_coming_in)

number=new_number.replace(" ,  " , "  . ")

Then the database won't complain



On Thursday, April 5, 2012 10:27:40 PM UTC-4, ydjango wrote:
>
> What is best way to allow users to enter decimal either as "." or as 
> ",'? 
> Currently if user enter "," django forms throw error. 
>
> I cannot change settings file based on user as same app serves users 
> worldwide.

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



Connecting User Accounts to Third Party Social Sites

2012-04-05 Thread Chris B
I'm trying to enable my users to connect their accounts with third party 
social networks like LinkedIn and Github.  I don't want my users to be able 
to create accounts on my site with those links, just connect their existing 
accounts.  Django-SocialRegistration looks best, but I can't figure out how 
to get it to get it to not try and create a new user account.  Are there 
any other social libraries that would work better?

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



Comma as decimal field

2012-04-05 Thread ydjango
What is best way to allow users to enter decimal either as "." or as
",'?
Currently if user enter "," django forms throw error.

I cannot change settings file based on user as same app serves users
worldwide.

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



Re: Django and MS-SQL

2012-04-05 Thread Python_Junkie
I use it for several applicartions.  Not sure that there is any difference 
with the various versions of sql server, except for minor syntax issues.

What did you want to know?

The performance is very good.

I have one application in which I use the admin interface which uses the 
ORM and I have another application that I just use the template system
for a fairly robust version control, software migration application.

For the 2nd application I just use plain old sql and the pyodbc module.
The django app complains if you don't put a connection string for sql 
server in the settings file, so I do that just to keep the appl happy.

Let me know what type of information you are interested in.



On Thursday, April 5, 2012 4:33:01 PM UTC-4, tizonzon wrote:
>
> Hi all,
> Can anyone share his experience about  developing application with django 
> that uses  Microsoft SQL server 2005 or later ?
> And how is it in production environment.
>
>
> Thanks 
>
>
>

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



HttpResponse_is_string is removed Django 1.4

2012-04-05 Thread Rajat Jain
Hi,

I have noticed that the class variable HttpReponse._is_string (in 
django/http/__init__.py) is removed in Django 1.4. I was setting this 
variable in a couple of places in my code, so that piece of code is 
breaking in Django 1.4. Do you know if this field is required at all? If 
not, is it just safe to remove this field altogether from my code?


Thanks,
Rajat

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



HttpResponse_is_string is removed Django 1.4

2012-04-05 Thread Rajat Jain
Hi,

I have noticed that the class variable HttpReponse._is_string (in
django/http/__init__.py) is removed in Django 1.4. I was setting this
variable in a couple of places in my code, so that piece of code is
breaking in Django 1.4. Do you know if this field is required at all? If
not, is it just safe to remove this field altogether from my code?


Thanks,
Rajat

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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 and MS-SQL

2012-04-05 Thread Adolphe Cher-Aime
Hi all,
Can anyone share his experience about  developing application with django
that uses  Microsoft SQL server 2005 or later ?
And how is it in production environment.


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: Can't display DateField on form with auto_now = True

2012-04-05 Thread Joel Goldstick
On Thu, Apr 5, 2012 at 1:27 PM, Joel Goldstick  wrote:
> I have a model with auto_now, and auto_now_add set for Update and Create 
> fields:
> class HotelProfiles(models.Model):
>    fe_result_id = models.AutoField(primary_key=True)
>    fe_created_date = models.DateTimeField(verbose_name='Created',
> blank=True, auto_now_add=True)
>    fe_updated_date = models.DateTimeField(verbose_name='Updated',
> blank=True, auto_now=True)
>
> In the Admin it displays both fields but leaves them uneditable.  They
> don't seem to be passed to my form to be rendered.  I don't want them
> to be editable, but I would like to display at the top of my form.
> How can I do this?
> --
> Joel Goldstick

I also posted this on Stack Exchange, and kept at it on my own.  I
came up with a solution here:
http://stackoverflow.com/questions/10033422/cant-display-datefield-on-form-with-auto-now-true/10035262#10035262


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



ADMIN_MEDIA_PREFIX deprecation and using static files

2012-04-05 Thread Rajat Jain
Hi,

I have a django 1.3 based frontend and it serves all the static files from
Amazon S3. I am wishing to upgrade to Django 1.4. It seems that Django has
changed the way admin static files are rendered. I have the following
configuration:

settings.py: I have the app django.contrib.staticfiles in INSTALLED_APPS
(in both 'dev' and 'prod' settings).
The static content is live on Amazon S3.

I am testing changes on my dev machine (DEBUG=True), but the /admin page is
not able to render the static files and icons. That is because it is trying
to pull stuff from S3 (because django.contrib.staticfiles is installed),
but not pulling in from the dev django folders. Is there a way in which I
can force the content out from dev folders when DEBUG = True rather than
pulling in from S3?


Thanks,
Rajat

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



Re: Problem with the tutorial.

2012-04-05 Thread J. Cliff Dyer
You might be overriding the DATABASES setting later on in your settings
file, or you might not be accessing the settings file you think you're
accessing.

Try running the following, to see what value you get:

$ python manage.py shell
>>> from django.conf import settings
>>> settings.DATABASES
[?]
>>> _


Cheers,
Cliff

On Wed, 2012-04-04 at 10:11 -0700, maxim wrote:
> When I try to run the command:
> python manage.py syncdb
> 
> 
> I get the following error:
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File
> "/usr/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 443, in execute_from_command_line
> utility.execute()
>   File
> "/usr/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 382, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/usr/lib/python2.7/site-packages/django/core/management/base.py",
> line 196, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File
> "/usr/lib/python2.7/site-packages/django/core/management/base.py",
> line 232, in execute
> output = self.handle(*args, **options)
>   File
> "/usr/lib/python2.7/site-packages/django/core/management/base.py",
> line 371, in handle
> return self.handle_noargs(**options)
>   File
> "/usr/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", 
> line 57, in handle_noargs
> cursor = connection.cursor()
>   File
> "/usr/lib/python2.7/site-packages/django/db/backends/dummy/base.py",
> line 15, in complain
> raise ImproperlyConfigured("settings.DATABASES is improperly
> configured. "
> django.core.exceptions.ImproperlyConfigured: settings.DATABASES is
> improperly configured. Please supply the ENGINE value. Check settings
> documentation for more details.
> 
> 
> But my settings file has the DATABASE section:
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.sqlite3', # Add
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': '/home/maxim/mysite/mysite.db',  #
> Or path to database file if using sqlite3.
> 'USER': '',  # Not used with sqlite3.
> 'PASSWORD': '',  # Not used with sqlite3.
> 'HOST': '',  # Set to empty string for
> localhost. Not used with sqlite3.
> 'PORT': '',  # Set to empty string for
> default. Not used with sqlite3.
> }
> }
> 
> 
> What could be causing the error?
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/jdYGuaXjoegJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: Where to load global static data?

2012-04-05 Thread Joel Goldstick
On Thu, Apr 5, 2012 at 8:21 AM, Lars Ruoff  wrote:
> On Apr 5, 9:43 am, Mike Dewhirst  wrote:
>> On 5/04/2012 4:53pm, Lars Ruoff wrote:
>>
>> > Sorry, that message went off (twice!) while i was in the middle of
>> > typing :-)
>>
>> > The question is:
>> > How do i load static global data once and for all at server startup.
>>
>> I think you would need to implement caching. 
>> Seehttps://docs.djangoproject.com/en/dev/topics/cache/
>>
>> Also, if you really want it pre-loaded you would probably need to write
>> a program to ensure all static data is fetched at webserver restart.
>>
>> But, normally static data isn't served by Django. It is usually kept in
>> a separate location from your Django code and served directly by the
>> webserver without getting Django involved at all. 
>> Seehttps://docs.djangoproject.com/en/dev/howto/static-files/
>>
>> Good luck
>>
>> Mike
>
>
> thanks Mike.
> sorry i had some problem with this thread so i tried to delete it and
> started another one.
> => Please continue here:
> http://groups.google.com/group/django-users/browse_thread/thread/9659ff188c59dc9b/3cae53e95b368229
>
> In short, i'm not talking about static data like pages/ressources to
> be served by the server, but static in the sense constant python data
> that is going to be read in once and then acessed at different parts
> of the python code.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

Why do you want it to be global?  You can create an app or just put
your data in one of your apps and import it to the other apps that
read it.
in my_dataset.py write code which (obviously more work than this):

 my_stuff = (1,2,3)

from mybigdatasetapp.my_dataset import my_stuff



-- 
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: Difficult setup on Suse Linux

2012-04-05 Thread Martin Sommer
Thanks Andre, logging.__file__ worked as with your setup, but the
issue still remained.

I changed to another VM where I have with Ubunto installed, and
everything works. Must be the Redhat/Suse vs the Debian/Ubuntu
approach. Not something I can spend time on right now.

Thanks for your help!!

Martin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: ModelForm based on User allows any username without checking

2012-04-05 Thread Pavan Verma
Hi Bastian,
you need to define the restrictions on the username field. It can be
done by including the code below inside usernameForm. This code is
from django/contrib/auth/forms.py -> UserCreationForm, you can refer
it to understand further.

username = forms.RegexField(label="Username", max_length=30,
regex=r'^[\w.@+-]+$',
help_text="Required. 30 characters or fewer. Letters, digits
and "
  "@/./+/-/_ only.",
error_messages={
'invalid': "This value may contain only letters, numbers
and "
 "@/./+/-/_ characters."})

thanks,
-pavan

On Apr 4, 7:36 pm, Bastian  wrote:
> Hi,
>
> I have a form that asks the registering user to choose a username. That
> form is a ModelForm based on the django.contrib.auth.models Users:
>
> class usernameForm(forms.ModelForm):
>     class Meta:
>         model = User
>         fields = ('username', )
>
> The strange thing is that when it appears on the page it comes with the
> warning that says no more than 30 characters... but it actually does not
> check anything. I tried to enter whatever username, with spaces and () and
> in the view when I ask if form.is_valid() it returns True all the time!
>
> Obviously this must be a mistake on my side somewhere but on such a simple
> setup I don't see where I am wrong, any idea welcome.

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



Can't display DateField on form with auto_now = True

2012-04-05 Thread Joel Goldstick
I have a model with auto_now, and auto_now_add set for Update and Create fields:
class HotelProfiles(models.Model):
fe_result_id = models.AutoField(primary_key=True)
fe_created_date = models.DateTimeField(verbose_name='Created',
blank=True, auto_now_add=True)
fe_updated_date = models.DateTimeField(verbose_name='Updated',
blank=True, auto_now=True)

In the Admin it displays both fields but leaves them uneditable.  They
don't seem to be passed to my form to be rendered.  I don't want them
to be editable, but I would like to display at the top of my form.
How can I do this?
-- 
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: how to

2012-04-05 Thread dummyman dummyman
no

On Thu, Apr 5, 2012 at 9:42 PM, Hum  wrote:

> does max_length work for IntegerFields?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: how to

2012-04-05 Thread Xavier Ordoquy
Hi,

That's for CharFields :)
IntergerFields in forms have max_value and min_value.

Regards,
Xavier,
Linovia

Le 5 avr. 2012 à 18:12, Hum a écrit :

> does max_length work for IntegerFields?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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.



how to

2012-04-05 Thread Hum
does max_length work for IntegerFields?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Comparing QuerySets

2012-04-05 Thread Andre Terra
Not sure if this is efficient, but you can try wrapping the values_list in
a set() call.

>>> set(ids1) == set(ids2)

True

>>> set(ids1) & set(ids2)

set([1])

>>> ids3 = set([])

>>> r = set(ids1) & set(ids3)

>>> r

set([])

>>> len(r)

0


Cheers,
AT

On Thu, Apr 5, 2012 at 6:07 AM, Thomas Guettler  wrote:

> I was surprised, that comparing querysets does not work:
>
> {{{
> from django.contrib.auth.models import User
> user_id=User.objects.all().**order_by('id')[0].id
>
> if not User.objects.filter(id=user_**id)==User.objects.filter(id=**
> user_id):
>print 'Not equal? I think they should be'
>
> ids1=User.objects.filter(id=**user_id).values_list('id', flat=True)
> ids2=User.objects.filter(id=**user_id).values_list('id', flat=True)
> if not ids1==ids2:
>print 'Not equal? I think they should be: %s %s' % (ids1, ids2)
>
> }}}
>
> Both, django 1.3 and 1.4 print this result:
>  Not equal? I think they should be
>  Not equal? I think they should be: [1] [1]
>
> I could not find a documentation of this in the django docs[1].
>
> Before creating a doc-ticket I want to ask here.
>
> [1] 
> https://docs.djangoproject.**com/en/dev/ref/models/**querysets/
>
> --
> Thomas Guettler, http://www.thomas-guettler.de/
> E-Mail: guettli (*) thomas-guettler + de
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> 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: Where/how to load global static data?

2012-04-05 Thread Tom Evans
On Thu, Apr 5, 2012 at 4:20 PM, bruno desthuilliers
 wrote:
> On Apr 5, 3:11 pm, Tom Evans  wrote:
>>
>> OP: I have a couple of solutions. One of the first things the server
>> does is import your settings, so if you load and parse your static
>> data at that point, then you will have access to it from that point
>> onwards.
>
> Please dont. Settings are, well, settings, and should contain as few
> executable code as possible.
>

I would disagree. If the running of your application depends upon
static content loaded from disk, it may be best to load it in
settings.py. If the code fails, your server fails to start (fail
fast).

In this particular place, it may make sense. The OP is talking about
loading static XML files, parsing them into a Python structure, and
making them available for all views, which require them to work.

As an example, say you use shared hosting, and your host writes your
DB credentials to an XML file in your webroot, readable only by the
webserver. Would it be wrong to parse that XML file in settings.py, in
order to produce the settings.DATABASES setting? Clearly not.

Django deliberately makes this path available to developers -
otherwise settings may as well come from a YAML file. It is up to you
to determine whether it is right or wrong for your particular project.

Cheers

Tom

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



Re: Where/how to load global static data?

2012-04-05 Thread bruno desthuilliers
On Apr 5, 3:11 pm, Tom Evans  wrote:
>
> OP: I have a couple of solutions. One of the first things the server
> does is import your settings, so if you load and parse your static
> data at that point, then you will have access to it from that point
> onwards.

Please dont. Settings are, well, settings, and should contain as few
executable code as possible.

A memoized function seems like the best solution here. Just for the
record, the usual way to have code executed at process startup is to
call this code from within one of your app's models.py - as theses
modules are garanteed to be imported by django at process startup (but
used to be executed twice when running anything from manage.py which
can be a PITA - this seems to have beed fixed the recent 1.4 release).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: List Users

2012-04-05 Thread Tom Evans
On Thu, Apr 5, 2012 at 3:00 PM, coded kid  wrote:
> I’m trying to iterate through user list member in tweepy. When I tried
> it out, it’s not displaying any user objects! The webpage is just
> blank. Below are my codes:

Have you tried spamming the tweepy mailing list instead of the Django one?

http://groups.google.com/group/tweepy

Cheers

Tom

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



Re: Where/how to load global static data?

2012-04-05 Thread Tom Evans
On Thu, Apr 5, 2012 at 2:45 PM, Lars Ruoff  wrote:
> Thanks a lot, Tom.
> That magnificantly answers my question. :-)
>
> One last thing:
>
> "... a function which loads, parses and returns
> the data, and memoize the result."
>
> That (and the first option also) means that we stay within the same
> Python interpreter environment even for different requests to the
> site?
>

No; that is highly unlikely, unless using a threaded model to run
Django*. You would have a separate cache per interpreter process.

Ideally, you would have a hook for server_init and hook for
child_init, just like something like Apache httpd, to allow you to
load data before forking. I believe something like this is planned, or
at least desired!

Cheers

Tom

* Whether you run threaded or non threaded is entirely at the
deployer's choice. See [1] for a detailed explanation of how mod_wsgi
will run your site, depending on how you configure it. So if
deployment is not under your control, you shouldn't use methods that
rely on running a threaded model.

[1] http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

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



List Users

2012-04-05 Thread coded kid
I’m trying to iterate through user list member in tweepy. When I tried
it out, it’s not displaying any user objects! The webpage is just
blank. Below are my codes:

Views:

def listmem(request):
consumer_key="XXX"
consumer_secret="XXX"
access_token="XXX"
access_token_secret="XXX"
auth=tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api=tweepy.API(auth)
Users= tweepy.Cursor(api.list_members, owner=request.user,
slug='slug').items()
for User in Users:
User.__getstate__()
return render_to_response('listmember.html',{'Users':
Users},context_instance=RequestContext(request))

Template:

{% block content %}
   {% for User in Users %}
  {{ User.author.screen_name}} 
  {% endfor %}

 {% endblock %}
How can I make it display user objects?

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



Re: Where/how to load global static data?

2012-04-05 Thread Lars Ruoff
Thanks a lot, Tom.
That magnificantly answers my question. :-)

One last thing:

"... a function which loads, parses and returns
the data, and memoize the result."

That (and the first option also) means that we stay within the same
Python interpreter environment even for different requests to the
site?

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



Re: Where/how to load global static data?

2012-04-05 Thread Tom Evans
On Thu, Apr 5, 2012 at 1:31 PM, kenneth gonsalves
 wrote:
> On Thu, 2012-04-05 at 05:25 -0700, Lars Ruoff wrote:
>> the question is not about serving static data (like HTML, images
>> etc.), but having global python variables initialized once, for all
>> instances of the site, that is, so they can be used from within each
>> view.
>
> this is precisely the point I addressed in my reply. Every request to
> django starts a new instance of django - and you have to initialise the
> variables again - cacheing may improve the performance. Django is not a
> server.

This is not true, please do not repeat it. Of course there are things
that are setup and torn down as part of the request/response cycle,
but there are many parts that are not.

OP: I have a couple of solutions. One of the first things the server
does is import your settings, so if you load and parse your static
data at that point, then you will have access to it from that point
onwards.

A second solution, somewhat less hacky, but not actually achieving
what you wish, is to have a function which loads, parses and returns
the data, and memoize the result. Further calls to the function,
within the same request or not, will not require the data to be loaded
again.

I use the second approach to handle static XML files that must be
parsed and loaded. One benefit of the second approach is that you can
memoize based upon a test. I use this so that as soon as the file on
disk has changed, the contents will be reloaded the next time the
function is called. The data is both static and dynamic!

Cheers

Tom

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



Re: Where/how to load global static data?

2012-04-05 Thread Lars Ruoff

On Apr 5, 2:31 pm, kenneth gonsalves  wrote:
> On Thu, 2012-04-05 at 05:25 -0700, Lars Ruoff wrote:
> > the question is not about serving static data (like HTML, images
> > etc.), but having global python variables initialized once, for all
> > instances of the site, that is, so they can be used from within each
> > view.
>
> this is precisely the point I addressed in my reply. Every request to
> django starts a new instance of django - and you have to initialise the
> variables again - cacheing may improve the performance. Django is not a
> server.
> --
> regards
> Kenneth Gonsalves

Kenneth, ok, sorry, i misunderstood your remark.
So as i understand, "new instance of Django" implies "new instance of
Python interpreter", right?
Then effectively there is no way of saving objects between instances. :
(

So how would you guys implement a (constant, possibly large) string
table that would be used in nearly every view?

regards,
Lars

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



Re: Where/how to load global static data?

2012-04-05 Thread kenneth gonsalves
On Thu, 2012-04-05 at 05:25 -0700, Lars Ruoff wrote:
> the question is not about serving static data (like HTML, images
> etc.), but having global python variables initialized once, for all
> instances of the site, that is, so they can be used from within each
> view. 

this is precisely the point I addressed in my reply. Every request to
django starts a new instance of django - and you have to initialise the
variables again - cacheing may improve the performance. Django is not a
server.
-- 
regards
Kenneth Gonsalves

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



Re: Where/how to load global static data?

2012-04-05 Thread Lars Ruoff
On Apr 5, 9:05 am, kenneth gonsalves  wrote:
> I may be wrong, but AFAIK django is not a server - it is a framework
> that runs on a web server, so every new request starts a new instance of
> your site. You could use cacheing to serve static data - but this is not
> like pre-loading data like one would do with zope for example.
> --
> regards
> Kenneth Gonsalves


Hi,
the question is not about serving static data (like HTML, images
etc.), but having global python variables initialized once, for all
instances of the site, that is, so they can be used from within each
view.
All pages should be able to access these global objects and they
should be loaded only once in memory.
The problem is indeed with the "start a new instance of the site".
Isn't there a way to pass constant data between instances?
It probably would require a callback that django calls when it is
invoked for the first time.
does this exist?


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



Re: Where to load global static data?

2012-04-05 Thread Lars Ruoff
On Apr 5, 9:43 am, Mike Dewhirst  wrote:
> On 5/04/2012 4:53pm, Lars Ruoff wrote:
>
> > Sorry, that message went off (twice!) while i was in the middle of
> > typing :-)
>
> > The question is:
> > How do i load static global data once and for all at server startup.
>
> I think you would need to implement caching. 
> Seehttps://docs.djangoproject.com/en/dev/topics/cache/
>
> Also, if you really want it pre-loaded you would probably need to write
> a program to ensure all static data is fetched at webserver restart.
>
> But, normally static data isn't served by Django. It is usually kept in
> a separate location from your Django code and served directly by the
> webserver without getting Django involved at all. 
> Seehttps://docs.djangoproject.com/en/dev/howto/static-files/
>
> Good luck
>
> Mike


thanks Mike.
sorry i had some problem with this thread so i tried to delete it and
started another one.
=> Please continue here:
http://groups.google.com/group/django-users/browse_thread/thread/9659ff188c59dc9b/3cae53e95b368229

In short, i'm not talking about static data like pages/ressources to
be served by the server, but static in the sense constant python data
that is going to be read in once and then acessed at different parts
of the python code.

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



Users Tweepy

2012-04-05 Thread coded kid
Hi guys, please how can I get a user username in tweepy? I hope you
get my point? 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.



[OT] Job offer for django developer

2012-04-05 Thread Marc Aymerich
We are an Spanish based organization looking for a Django developer
for an European project related to commuinity networks (guifi.net,
FunkFeuer and AWMN). The project is called CONFINE
(http://confine-project.eu) and its goal is to create a testbed
platform allowing researches to deploy their network experiments
within a real environment based on community networks.

The job will consists on collaborate on the development of the testbed
control software (server side), entarily based on Django. Some of the
features expected for this software are:
Automatically register new nodes.
Experiment management (executing, monitoring and results gattering).
Monitorization of the nodes state and their connectivity status.
...

The unique requirement is wide experience with Django framework but we
also valorate:
- Knowladge of community networks (like guifi.net, FunkFeuer and AWMN)
- Knowladge of virtualization (LXC), JSON, Linux and networking
(traffic shaping, routing, vlans..)

We are offering a partial time job (20h/week) with the posibility to
extend it to full time (40h/week)
The contract will be for 12 months (possible to extend to 2- 3 years).
The gross salary for 20h/week is 12.600€/year.
working remotely is possible but we prefer an European based
developer, since all partners are from Europe and it will be easy to
arrange 1 or 2 year meetings.

Please if you are intereseted send your cv at ad...@pangea.org

-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Difficult setup on Suse Linux

2012-04-05 Thread Andre Terra
There's a chance you have a logging module in your PATH that is shadowing
the default package.

Did you create an app or project named logging by any chance?

Ideas:
- From an interactive python shell, import logging and check
logging.__file__

In my Ubuntu install, I get:
/usr/lib/python2.7/logging/__init__.pyc

- Install virtualenv and create an environment using the --no-site-packages
and install nothing but Django. Try running it from there and see what
happens. Ideally, you'll want to use virtual environments always.

I'm hoping one of these solutions will help, but I'm really just guessing.

Cheers,
AT

-- Sent from my phone, please excuse any typos. --

On Apr 5, 2012 8:22 AM, "Martin Sommer"  wrote:
>
> Its Django 1.3.1, with Python 2.4.1. The Django docs say that this
> would work.
>
> https://docs.djangoproject.com/en/1.3/intro/install/
>
> Martin
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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.



Tweepy Users

2012-04-05 Thread Picomon
Hello, how can I get user's username only in django/ tweepy? I hope
you get my point? 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: Problem with Django tutorial

2012-04-05 Thread Rahul Katragadda
>
> [04/Apr/2012 14:36:13] "GET */admin/admin/css/*base.css HTTP/1.1" 404 3861
> [04/Apr/2012 14:36:13] "GET */admin/admin/css/*dashboard.css HTTP/1.1"
> 404 3876


Is this directory (in bold) correct?

On 5 April 2012 00:19, maxim  wrote:

> Continuing on in the tutorial, I got to the part where it explains how to
> use the admin site. It seems that after enabling the admin, it cannot find
> the css files it uses, so the web page looks very strange.
>
> When making a request for an admin page I get the following output from
> the runserver:
> [04/Apr/2012 14:36:12] "GET /admin/ HTTP/1.1" 200 3740
> [04/Apr/2012 14:36:13] "GET /admin/admin/css/base.css HTTP/1.1" 404 3861
> [04/Apr/2012 14:36:13] "GET /admin/admin/css/dashboard.css HTTP/1.1" 404
> 3876
>
> Which seems to indicate that it can't find base.css and dashboard.css.
>
> I tried following the steps in the Customizing Admin Look and feel to get
> custom templates working to change the urls, but with no luck.
> How do I get the default admin to find its css files?
>
>
> On Wednesday, 4 April 2012 12:51:39 UTC-4, maxim wrote:
>>
>> I can't get the tutorial working for me. When I try to run the command:
>> python manage.py syncdb
>>
>> I get this error:
>> Traceback (most recent call last):
>>   File "manage.py", line 10, in 
>> execute_from_command_line(sys.**argv)
>>   File 
>> "/usr/lib/python2.7/site-**packages/django/core/**management/__init__.py",
>> line 443, in execute_from_command_line
>> utility.execute()
>>   File 
>> "/usr/lib/python2.7/site-**packages/django/core/**management/__init__.py",
>> line 382, in execute
>> self.fetch_command(subcommand)**.run_from_argv(self.argv)
>>   File "/usr/lib/python2.7/site-**packages/django/core/**management/base.py",
>> line 196, in run_from_argv
>> self.execute(*args, **options.__dict__)
>>   File "/usr/lib/python2.7/site-**packages/django/core/**management/base.py",
>> line 232, in execute
>> output = self.handle(*args, **options)
>>   File "/usr/lib/python2.7/site-**packages/django/core/**management/base.py",
>> line 371, in handle
>> return self.handle_noargs(**options)
>>   File "/usr/lib/python2.7/site-**packages/django/core/**
>> management/commands/syncdb.py"**, line 57, in handle_noargs
>> cursor = connection.cursor()
>>   File 
>> "/usr/lib/python2.7/site-**packages/django/db/backends/**dummy/base.py",
>> line 15, in complain
>> raise ImproperlyConfigured("**settings.DATABASES is improperly
>> configured. "
>> django.core.exceptions.**ImproperlyConfigured: settings.DATABASES is
>> improperly configured. Please supply the ENGINE value. Check settings
>> documentation for more details.
>>
>> My settings file has this for databases:
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.sqlite3', # Add
>> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
>> 'NAME': '/home/maxim/mysite/mysite.db'**,  #
>> Or path to database file if using sqlite3.
>> 'USER': '',  # Not used with sqlite3.
>> 'PASSWORD': '',  # Not used with sqlite3.
>> 'HOST': '',  # Set to empty string for
>> localhost. Not used with sqlite3.
>> 'PORT': '',  # Set to empty string for
>> default. Not used with sqlite3.
>> }
>> }
>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/7-6nFmQGXpMJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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.



Unable to open database file

2012-04-05 Thread KriRad
There were so many posts like this and I have looked at them both in
the graphite forum as well as this.

I see three 'settings.py' files.

usr/lib/pymodules/python2.7/django/conf/project_template/
settings.py:DATABASES = {
/usr/lib/pymodules/python2.6/django/conf/project_template/
settings.py:DATABASES = {
/usr/share/pyshared/django/conf/project_template/settings.py:DATABASES
= {

 I am not using python2.6 because when I type 'python' I get the
following prompt.

Python 2.7.2+ (default, Oct 4 2011, 20:03:08)
[GCC 4.6.1] on linux2

I have updated both the following files. .

/usr/lib/pymodules/python2.7/django/conf/project_template/settings.py
/usr/share/pyshared/django/conf/project_template/settings.py

Both have this updated section. I have tried without 'touching nio.db'
and also by touching it based on a forum suggestion.

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqllite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '/user/django//db/nio.db',  # Or
path to database file if using sqlite3.
'USER': '',  # Not used with sqlite3.
'PASSWORD': '',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for
default. Not used with sqlite3.

1. The path is absolute
2. Full permissions are given to the parent and child folders
3. Checked Ubuntu's(11.10) access logs to confirm 'root' is the user
trying to run the command.

Apr  5 17:28:09 CHNDLINUX sudo: fssadmin : TTY=pts/2 ; PWD=/home/user/
graphite/graphite-web-0.9.9/webapp/graphite ; USER=root ; COMMAND=/usr/
bin/vi /usr/share/pyshared/django/conf/project_template/settings.py

No respite though. It still shows "self.connection =
Database.connect(**kwargs)"

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.



Custom AdminSite and urlresolvers.reverse

2012-04-05 Thread cyrus
Hello,

We have implemented three different ModelAdmin sub-classes for the same 
model, registered under three different AdminSites. Nothing fancy there, 
only some business logic was implemented differently. After we upgraded 
from Django 1.2.3 to Django 1.4 these model admins started to fail on the 
change forms when using the save action with the following error:

Reverse for '__changelist' with arguments '()' and 
keyword arguments '{}' not found.


The admin site was initialized with a different name and app_name:

admin_site = admin.AdminSite("my_custom_admin", "my_custom_admin")

class MyModelAdmin(admin.ModelAdmin):
# some small configurations for change_view, static files, permissions 
e.t.c.

admin_site.register(MyModel, MyModelAdmin)


After digging into the following line in django/contrib/admin/options.py:847

def response_change(self, request, obj):
# ...
else:
# ...
if self.has_change_permission(request, None):
->  post_url = reverse('admin:%s_%s_changelist' %
   (opts.app_label, module_name),
   current_app=self.admin_site.name)
else:
post_url = reverse('admin:index',
   current_app=self.admin_site.name)
return HttpResponseRedirect(post_url)


As you can see the *admin* namespace is hardcoded into the reverse 
expression. If I do the lookup with *
my_custom_admin:__changelist *it works as expected. 

I'm I doing something wrong? Was this an issue in Django 1.2 that got fixed 
or this is a bug in the admin app?

P.S.: Everything was working well on Django 1.2.x until we upgraded to 
Django 1.4. Because of this I'm not sure in which version exactly this 
problem appeared. 

Thanks,
Ion

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Y5KFOyaTcMMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Difficult setup on Suse Linux

2012-04-05 Thread Martin Sommer
Its Django 1.3.1, with Python 2.4.1. The Django docs say that this
would work.

https://docs.djangoproject.com/en/1.3/intro/install/

Martin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: calculate default values for fields based on the content of other fields

2012-04-05 Thread Jaroslav Dobrek


On 5 Apr., 10:40, Xavier Ordoquy  wrote:
> Hi,
>
> I'm not sure I clearly understood your issue.
> Do you want some choice fields to limit their choices according to another 
> choice field value ?

No. I want to use prepopulated editable char fields. The content of
those fields should be calculated using the content of another char
field.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: saving a model instance in a view

2012-04-05 Thread kenneth gonsalves
On Thu, 2012-04-05 at 03:51 -0700, MikeKJ wrote:
> c = Name.objects.get(trans_id = request.GET.get('trans_id'))
> if c:
>  u = Name()
>  c.paid = 1
>  u.save() 

if c:
c.paid=1
c.save()
-- 
regards
Kenneth Gonsalves

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



Re: saving a model instance in a view

2012-04-05 Thread MikeKJ

Gaaah another brain fart, forget this one too

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



saving a model instance in a view

2012-04-05 Thread MikeKJ
c = Name.objects.get(trans_id = request.GET.get('trans_id'))
if c:
 u = Name()
 c.paid = 1
 u.save()

This isnt saving to same object but adding a blank row and not even 
changing the boolean value field of paid, someone please point out my error 
that I cannot see

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/zIfM6QnXnPsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Port Django to Javascript

2012-04-05 Thread Davide Callegari
Hi Sébastien,
thanks to the database routing system and the possibility add any backend 
database (or data source, however you wanna call it) directly into broke, or 
your project.
You can think of it as a sort of plugin system that anyone can use.

For instance, if you are using django-piston or django-tastypie to create a 
nice public API, you can create a db backend to match your public api, however 
you wanna create it.
Using the models you can do stuff like:

MyModel.objects.filter({ id__gte: 10 }).using('nodejs-remote-backend').all()

and you get all the data you want from that db backend or you can use a db 
router to make sure all the requests for that model are redirected to that 
specific db backend.

Thanks for the support :)

Davide


Il giorno 05/apr/2012, alle ore 10:42, sebastien piquemal ha scritto:

> I guess the people that don't get the point have probably never made a heavy 
> Javascript application ... Ever used Backbone.js ?
> 
> client-side - one page - websites are much nicer to use than any website with 
> a page load after every click.
> 
> So I totally understand why you would do such a project, and I actually think 
> it is a lovely idea !!! On the other hand, I've started to think lately that 
> Django is not the best backend solution for building such applicatons.
> So, @davide, how do you plan on making sure that any weird API can be 
> plugged-in to the system ... will you separate nicely the model layer from 
> the "backend" (web API, or dummy data store, or whatever) ???
> 
> Cheers anyway, and I'll follow the project !
> 
> Sébastien

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



Comparing QuerySets

2012-04-05 Thread Thomas Guettler

I was surprised, that comparing querysets does not work:

{{{
from django.contrib.auth.models import User
user_id=User.objects.all().order_by('id')[0].id

if not User.objects.filter(id=user_id)==User.objects.filter(id=user_id):
print 'Not equal? I think they should be'

ids1=User.objects.filter(id=user_id).values_list('id', flat=True)
ids2=User.objects.filter(id=user_id).values_list('id', flat=True)
if not ids1==ids2:
print 'Not equal? I think they should be: %s %s' % (ids1, ids2)

}}}

Both, django 1.3 and 1.4 print this result:
  Not equal? I think they should be
  Not equal? I think they should be: [1] [1]

I could not find a documentation of this in the django docs[1].

Before creating a doc-ticket I want to ask here.

[1] https://docs.djangoproject.com/en/dev/ref/models/querysets/

--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Port Django to Javascript

2012-04-05 Thread sebastien piquemal
I guess the people that don't get the point have probably never made a 
heavy Javascript application ... Ever used Backbone.js ?

client-side - one page - websites are much nicer to use than any website 
with a page load after every click.

So I totally understand why you would do such a project, and I actually 
think it is a lovely idea !!! On the other hand, I've started to think 
lately that Django is not the best backend solution for building such 
applicatons.
So, @davide, how do you plan on making sure that any weird API can be 
plugged-in to the system ... will you separate nicely the model layer from 
the "backend" (web API, or dummy data store, or whatever) ???

Cheers anyway, and I'll follow the project !

Sébastien

On Thursday, April 5, 2012 9:22:13 AM UTC+3, DvD wrote:
>
> Hi folks,
> I created a project not long ago and I'm currently maintaining it called 
> Broke which wants to be a porting to Javascript of Django 
> https://github.com/brokenseal/broke-client
> You can find it featured inside the todomvc project from addy osmani 
> https://github.com/addyosmani/todomvc ( 
> https://github.com/brokenseal/todomvc for the latest updates from broke )
>
> I think the project itself has a lot of potential but lacks two very 
> important things: a real documentation and a community.
> I'm writing to you all to see if anyone could be interested in taking part 
> to this project.
> Broke currently features a lot of cool stuff such as:
>  - pythonic classes and models: write stuff like
>
> models.Model.create({
> __name__: "todo.models.Task"
> ,title: models.CharField({ max_length: 200 })
> ,is_complete: models.BooleanField({ 'default': false })
> ,update: function(kwargs){
> if('is_complete' in kwargs && kwargs['is_complete']) {
> this.elements().addClass('done');
> } else if('is_complete' in kwargs && !kwargs['is_complete']) {
> this.elements().removeClass('done');
> }
>
> return this._super(kwargs);
> }
> });
>
>  - django templating: you can basically reuse the same templates you are 
> currently using server side, with some limitations ( the only supported 
> tags are if-else, for cycles, ifequal, comment )
>  - database routing: you can choose to save your object on any data source 
> you want ( local storage, remote server, a local json object )
>
> Have a look at the code base and let me know what you think.
> Anyone? :)
>
> Cheers,
> Davide
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/dKBwY_yj9kMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: calculate default values for fields based on the content of other fields

2012-04-05 Thread Xavier Ordoquy
Hi,

I'm not sure I clearly understood your issue.
Do you want some choice fields to limit their choices according to another 
choice field value ?

Regards,
Xavier.

Le 4 avr. 2012 à 15:09, Jaroslav Dobrek a écrit :

> Hello,
> 
> is there a way to calculate default values for certain fields based
> on the content of other fields?
> 
> I am implementing a dictionary. Admins are supposed to add words of
> certain languages and parts-of-speech. Some words of some
> part-of-speech and language are, on one hand, morphologically very
> regular, but, one the other hand, come with a huge number of
> morphological
> forms. This is true for German adjectives: They usually have 183
> morphological forms (if form-meaning pairs are counted). On the other
> hand, there are very few irregular adjectives. The most user-friendly
> way for admins to code German adjectives would be this: The admin adds
> a new adjective and types in the adjective's base form:
> 
> base form: |gut|
> 
> Then he clicks some button or saves the adjective or, ideally, does
> nothing, and the program fills in the 183 fields below, using the base
> form and
> assuming that the adjective is regular:
> 
> attributive positive strong masculine nominative singular: |guter|
> attributive positive strong masculine genitive singular:   |guten|
> attributive positive strong masculine dative singular: |gutem|
> attributive positive strong masculine accusative singular: |guten|
> ...
> attributive comparative strong masculine nominative singular: |
> guterer|
> ...
> 
> The admin now has the possibility to correct the wrong forms before
> saving the adjective. This way, in the vast majority of cases all the
> coding is done completely
> automatically. And for the very few irregular adjectives, the admin
> only has to modify those
> forms that have been guessed wrongly.
> 
> Any ideas how to realize this?
> 
> Jaroslav
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: calculate default values for fields based on the content of other fields

2012-04-05 Thread Jaroslav Dobrek
> However, I don't think you need to do this at all. I would say you
> would only populate the other fields if they are all empty, and the
> base is not empty. If the other fields are not empty, either it has
> already been pre-populated, or it has been filled in manually, and you
> should not change it. Seems pretty straightforward!

I think this is not an option: In the majority of cases, correcting a
form will mean to delete it.
Example: The program might generate the comparative form "magicaler"
and the superlative form
"magicalest" for the English adjective "magical". The administrator's
job is to delete these
forms. Of course, I might require every field to have a content and
use some special symbol, such
as '-' to denote that a field is empty. But I think this would
unnecessarily complicate the coders'
work. The fewer rules and conventions the coder needs to know, the
better. And it wouldn't help
either, because sometimes - for example in the case of English
adjectives of a certain length -
the program would assign this symbol or the empty string itself.

> save() happens before the data is saved to the database (well, its the
> last things that happens in Model.save()). So you can pull the
> original data from the database, and compare it to the one you are
> being asked to save.

I don't quite understand you. Where exactly is the data I am "being
asked to save"? The following
function might be an approximation to what you suggest:

def save(self, *args,
**kwargs):
#1
tmp =
self.attr_pos_str_masc_nom_sing
#2
if tmp !=
self.default_attr_pos_str_masc_nom_sing()
#3
 
pass
#4
 
else:
#5
self.attr_pos_str_masc_nom_sing =
self.default_attr_pos_str_masc_nom_sing() #6
super(GermanAdjective, self).save(*args,
**kwargs)   #7

(I hope this will keep its indentation.)

In line 2, I look up the value of the field
attr_pos_str_masc_nom_sing. In line 3, I check
if the current value of this field differs from the default value for
this field. If so, I assume that
the field has been edited and do nothing. Yet, when an adjective is
created, this field is empty,
so the test is positive and nothing is done.

Jaroslav

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Port Django to Javascript

2012-04-05 Thread DvD
Thanks for asking, Marcin.

This project started back in 2009 because at that time there was not even a 
single js mvc framework around that I liked ( at that time the only ones 
around were JavascriptMVC, Jamal and another one, can't remember the name ).
That's the main reason behind this project but there are plenty more than 
that.

What I essentially ported to js is the philosophy that we all love and care 
for, from Django and a feeling that this is missing on the js communities. 
It's like when Django started: why didn't they use Rails? Same reasons here.

Cheers!
Davide



Il giorno giovedì 5 aprile 2012 08:36:03 UTC+2, Marcin ha scritto:
>
> What's the motivation for this project? Who (especially already being 
> familiar with python and django) would want to use this, and for what?
>
> On Thu, Apr 5, 2012 at 07:22, DvD  wrote:
>
>> Hi folks,
>> I created a project not long ago and I'm currently maintaining it called 
>> Broke which wants to be a porting to Javascript of Django 
>> https://github.com/brokenseal/broke-client
>> You can find it featured inside the todomvc project from addy osmani 
>> https://github.com/addyosmani/todomvc ( 
>> https://github.com/brokenseal/todomvc for the latest updates from broke )
>>
>> I think the project itself has a lot of potential but lacks two very 
>> important things: a real documentation and a community.
>> I'm writing to you all to see if anyone could be interested in taking 
>> part to this project.
>> Broke currently features a lot of cool stuff such as:
>>  - pythonic classes and models: write stuff like
>>
>> models.Model.create({
>> __name__: "todo.models.Task"
>> ,title: models.CharField({ max_length: 200 })
>> ,is_complete: models.BooleanField({ 'default': false })
>> ,update: function(kwargs){
>> if('is_complete' in kwargs && kwargs['is_complete']) {
>> this.elements().addClass('done');
>> } else if('is_complete' in kwargs && !kwargs['is_complete']) {
>> this.elements().removeClass('done');
>> }
>>
>> return this._super(kwargs);
>> }
>> });
>>
>>  - django templating: you can basically reuse the same templates you are 
>> currently using server side, with some limitations ( the only supported 
>> tags are if-else, for cycles, ifequal, comment )
>>  - database routing: you can choose to save your object on any data 
>> source you want ( local storage, remote server, a local json object )
>>
>> Have a look at the code base and let me know what you think.
>> Anyone? :)
>>
>> Cheers,
>> Davide
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/nXspKySFAhQJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> -- 
> Marcin Tustin
> Tel: 07773 787 105
>
>

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



Improving Site Performance

2012-04-05 Thread Swaroop Shankar V
Hi All,
Am developing a site using django and it is almost ready to be launched.
Right now am trying to optimize the performance of the site. I have
installed the django debug toolbar and when i checked the number of queries
being exicuted on the homepage i could see there are 74 queries
being executed. On debugging I could see that most of the queries  are
through the context_instance=RequestContext(request) that am passing to a
view. When I removed it I could see the queries where reduced to 24, which
improved the performance, but I end up in an error

Caught KeyError while rendering: 'request'

this is happening because the homepage is rendering a custom template
tag which requires the request object available (to access the
currently logged in user details). So is there any way to avoid using
context_instance=RequestContext(request) and still make the request
object accessible in the custom template tag?

Thanks and Regards,
Swaroop Shankar V

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



Re: Where to load global static data?

2012-04-05 Thread Mike Dewhirst

On 5/04/2012 4:53pm, Lars Ruoff wrote:

Sorry, that message went off (twice!) while i was in the middle of
typing :-)

The question is:
How do i load static global data once and for all at server startup.


I think you would need to implement caching. See 
https://docs.djangoproject.com/en/dev/topics/cache/


Also, if you really want it pre-loaded you would probably need to write 
a program to ensure all static data is fetched at webserver restart.


But, normally static data isn't served by Django. It is usually kept in 
a separate location from your Django code and served directly by the 
webserver without getting Django involved at all. See 
https://docs.djangoproject.com/en/dev/howto/static-files/


Good luck

Mike


I.e. i'd like to have that data in memory and accessible from any view
during the lifetime of the server, so that it needs NOT to be loaded
for any access to the site/view.

Hope the question is clear.
Regards,
Lars



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Port Django to Javascript

2012-04-05 Thread kenneth gonsalves
On Thu, 2012-04-05 at 00:00 -0700, Lars Ruoff wrote:
> On Apr 5, 8:48 am, kenneth gonsalves  wrote:
> > frankly these are not questions to be asked of an open source
> project.
> 
> On the contrary, many more open source projects should ask themselves
> that question! 

I remember a guy, his name has slipped my mind, who released a kernel
and mentioning that it most probably would not be useful as better ones
were around, but he did so because he felt that someone, somewhere *may*
find it of interest.
-- 
regards
Kenneth Gonsalves

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



Re: Where/how to load global static data?

2012-04-05 Thread kenneth gonsalves
On Wed, 2012-04-04 at 23:56 -0700, Lars Ruoff wrote:
> I'd like to know where to put the code that reads these files and
> initialzes the global data once and for all at server startup.
> I.e. i'd like to have that data in memory and accessible from any
> view
> during the lifetime of the server, so that it needs NOT to be loaded
> for any access to the site/view.
> 
> 

I may be wrong, but AFAIK django is not a server - it is a framework
that runs on a web server, so every new request starts a new instance of
your site. You could use cacheing to serve static data - but this is not
like pre-loading data like one would do with zope for example.
-- 
regards
Kenneth Gonsalves

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



Re: Port Django to Javascript

2012-04-05 Thread Lars Ruoff
On Apr 5, 8:48 am, kenneth gonsalves  wrote:
> frankly these are not questions to be asked of an open source project.

On the contrary, many more open source projects should ask themselves
that question!

I'm very much interested in the answer, since i really don't get it.
Why would you re-invent a server-side application framework on client-
side??

regards,
Lars

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



Where/how to load global static data?

2012-04-05 Thread Lars Ruoff
Hi,
i'm using Django the first time for a browser game project.
I will need to have some globally accessible, static data like string
tables for every view.
These would be loaded from XML files.
For the moment all i have figured out with Django is that my code
will
be called via callbacks for the view when accessing a particular URL.
Obviously, i don't want to reload that data with *each* access to a
view.
I'd like to know where to put the code that reads these files and
initialzes the global data once and for all at server startup.
I.e. i'd like to have that data in memory and accessible from any
view
during the lifetime of the server, so that it needs NOT to be loaded
for any access to the site/view.

Hope the question is clear.

Regards,
Lars

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



Re: Where to load global static data?

2012-04-05 Thread Lars Ruoff
Sorry, that message went off (twice!) while i was in the middle of
typing :-)

The question is:
How do i load static global data once and for all at server startup.
I.e. i'd like to have that data in memory and accessible from any view
during the lifetime of the server, so that it needs NOT to be loaded
for any access to the site/view.

Hope the question is clear.
Regards,
Lars

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



Where to load global static data?

2012-04-05 Thread Lars Ruoff
Hi,
i'm using Django the first time for a browser game project.
I will need to have some globally accessible, static data like string
tables for every view.
These would be loaded from XML files.
For the moment all i have figured out with Django is that my code will
be called via callbacks for the view when accessing a particular URL.
Obviously, i don't want to relo
I'd like to know where to put the code that reads these files and
initialzes the global data.

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



Where to load global static data?

2012-04-05 Thread Lars Ruoff
Hi,
i'm using Django the first time for a browser game project.
I will need to have some globally accessible, static data like string
tables for every view.
These would be loaded from XML files.
For the moment all i have figured out with Django is that my code will
be called via callbacks for the view when accessing a particular URL.
Obviously, i don't want to relo
I'd like to know where to put the code that reads these files and
initialzes the global data.

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



Re: Port Django to Javascript

2012-04-05 Thread kenneth gonsalves
On Thu, 2012-04-05 at 07:36 +0100, Marcin Tustin wrote:
> What's the motivation for this project? Who (especially already being
> familiar with python and django) would want to use this, and for
> what? 

frankly these are not questions to be asked of an open source project. 
-- 
regards
Kenneth Gonsalves

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



Re: Port Django to Javascript

2012-04-05 Thread Marcin Tustin
What's the motivation for this project? Who (especially already being
familiar with python and django) would want to use this, and for what?

On Thu, Apr 5, 2012 at 07:22, DvD  wrote:

> Hi folks,
> I created a project not long ago and I'm currently maintaining it called
> Broke which wants to be a porting to Javascript of Django
> https://github.com/brokenseal/broke-client
> You can find it featured inside the todomvc project from addy osmani
> https://github.com/addyosmani/todomvc (
> https://github.com/brokenseal/todomvc for the latest updates from broke )
>
> I think the project itself has a lot of potential but lacks two very
> important things: a real documentation and a community.
> I'm writing to you all to see if anyone could be interested in taking part
> to this project.
> Broke currently features a lot of cool stuff such as:
>  - pythonic classes and models: write stuff like
>
> models.Model.create({
> __name__: "todo.models.Task"
> ,title: models.CharField({ max_length: 200 })
> ,is_complete: models.BooleanField({ 'default': false })
> ,update: function(kwargs){
> if('is_complete' in kwargs && kwargs['is_complete']) {
> this.elements().addClass('done');
> } else if('is_complete' in kwargs && !kwargs['is_complete']) {
> this.elements().removeClass('done');
> }
>
> return this._super(kwargs);
> }
> });
>
>  - django templating: you can basically reuse the same templates you are
> currently using server side, with some limitations ( the only supported
> tags are if-else, for cycles, ifequal, comment )
>  - database routing: you can choose to save your object on any data source
> you want ( local storage, remote server, a local json object )
>
> Have a look at the code base and let me know what you think.
> Anyone? :)
>
> Cheers,
> Davide
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/nXspKySFAhQJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Marcin Tustin
Tel: 07773 787 105

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



Port Django to Javascript

2012-04-05 Thread DvD
Hi folks,
I created a project not long ago and I'm currently maintaining it called 
Broke which wants to be a porting to Javascript of 
Django https://github.com/brokenseal/broke-client
You can find it featured inside the todomvc project from addy osmani 
https://github.com/addyosmani/todomvc ( 
https://github.com/brokenseal/todomvc for the latest updates from broke )

I think the project itself has a lot of potential but lacks two very 
important things: a real documentation and a community.
I'm writing to you all to see if anyone could be interested in taking part 
to this project.
Broke currently features a lot of cool stuff such as:
 - pythonic classes and models: write stuff like

models.Model.create({
__name__: "todo.models.Task"
,title: models.CharField({ max_length: 200 })
,is_complete: models.BooleanField({ 'default': false })
,update: function(kwargs){
if('is_complete' in kwargs && kwargs['is_complete']) {
this.elements().addClass('done');
} else if('is_complete' in kwargs && !kwargs['is_complete']) {
this.elements().removeClass('done');
}

return this._super(kwargs);
}
});

 - django templating: you can basically reuse the same templates you are 
currently using server side, with some limitations ( the only supported 
tags are if-else, for cycles, ifequal, comment )
 - database routing: you can choose to save your object on any data source 
you want ( local storage, remote server, a local json object )

Have a look at the code base and let me know what you think.
Anyone? :)

Cheers,
Davide

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/nXspKySFAhQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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 Contrib Auth + Class Based Generic Views

2012-04-05 Thread Sergiy Khohlov
As I understand you would like to send some values to the templates ?
Are you eould like to check if user is authenticated ?
I 've understand near to nothing from  your last message.


2012/4/5 Matheus Ashton :
> Ok, Thanks for the advices :) but I still have the original problem, when i
> access the HomeView the template is rendered with a render_to_response view,
> with a simple Context object and not a RequestContext object, because of
> that I do not have the authenticated user data in my template...
>
>
> 2012/4/4 Sergiy Khohlov 
>>
>> Sound good!
>> Usually  project is not so simple (only url.py + settings.py)
>>
>> 2012/4/4 Javier Guerra Giraldez :
>> > On Wed, Apr 4, 2012 at 4:14 AM, Sergiy Khohlov 
>> > wrote:
>> >> As result  your views.py should be :
>> >>
>> >> from django.views.generic import TemplateView
>> >> # Create your views here.
>> >> class HomeView(TemplateView):
>> >>    template_name='home.html'
>> >>
>> >>  Only three lines of the code !
>> >> You dont  need more!
>> >
>> > if in urls.py you replace
>> >
>> >  (r'^$', login_required(HomeView.as_view())),
>> >
>> > with
>> >  (r'^$',
>> > login_required(TemplateView(template_name='home.html').as_view())),
>> >
>> >
>> > you don't need any HomeView class!
>> >
>> >
>> > --
>> > 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.