Re: how to display development server page

2012-03-16 Thread Alex Glaros
Thanks Daniel,

Does that mean I have to copy python, Django, and Postgres to my PC to
create the development environment?

much appreciated,

Alex Glaros

On Mar 16, 10:32 pm, Daniel Roseman  wrote:
> On Friday, 16 March 2012 22:23:43 UTC-7, Alex Glaros wrote:
>
> > Newbie trying to run Django for the first time.
>
> > I'm using a hosted Linux server; I run python manage.py runserver, and
> > get:
>
> > Validating models...
>
> > 0 errors found
> > Django version 1.3.1, using settings 'alexSite.settings'
> > Development server is running athttp://127.0.0.1:8000/
> > Quit the server with CONTROL-C.
>
> > But my browser doesn't see anything athttp://127.0.0.1:8000/
>
> > Any hints?  Where is the page, on my PC or the hosted server?
>
> > Thanks,
>
> > Alex Glaros
>
> The development server isn't meant to be run on a host. It's meant to be
> run on your development machine.
>
> (You can make this work, but your life will be simpler if you install and
> run Django locally when in development).
> --
> 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: how to display development server page

2012-03-16 Thread Daniel Roseman
On Friday, 16 March 2012 22:23:43 UTC-7, Alex Glaros wrote:
>
> Newbie trying to run Django for the first time. 
>
> I'm using a hosted Linux server; I run python manage.py runserver, and 
> get: 
>
> Validating models... 
>
> 0 errors found 
> Django version 1.3.1, using settings 'alexSite.settings' 
> Development server is running at http://127.0.0.1:8000/ 
> Quit the server with CONTROL-C. 
>
> But my browser doesn't see anything at http://127.0.0.1:8000/ 
>
> Any hints?  Where is the page, on my PC or the hosted server? 
>
> Thanks, 
>
> Alex Glaros


The development server isn't meant to be run on a host. It's meant to be 
run on your development machine.

(You can make this work, but your life will be simpler if you install and 
run Django locally when in development).
--
DR.

-- 
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/-/3he_ZgLIx4kJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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 display development server page

2012-03-16 Thread Alex Glaros
Newbie trying to run Django for the first time.

I'm using a hosted Linux server; I run python manage.py runserver, and
get:

Validating models...

0 errors found
Django version 1.3.1, using settings 'alexSite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

But my browser doesn't see anything at http://127.0.0.1:8000/

Any hints?  Where is the page, on my PC or the hosted server?

Thanks,

Alex Glaros

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: python manage.py syncdb Error: No module named messages

2012-03-16 Thread Shawn Milochik

Not a PATH issue, but a PYTHONPATH issue.

Run "python manage.py shell" and try to import 'messages.'

I suspect it's not where you think it is, or its location is not on your 
PYTHONPATH.



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: python manage.py syncdb Error: No module named messages

2012-03-16 Thread Robert Steckroth
Ya, it is probably a path issue. It is set as this by the way -->
 ['',
'/usr/lib64/python2.4/site-packages/MySQL_python-1.2.3c1-py2.4-linux-x86_64.egg',
'/usr/lib64/python24.zip', '/usr/lib64/python2.4',
'/usr/lib64/python2.4/plat-linux2', '/usr/lib64/python2.4/lib-tk',
'/usr/lib64/python2.4/lib-dynload', '/usr/lib64/python2.4/site-packages',
'/usr/lib/python2.4/site-packages']


-- 
Bust0ut, Surgemcgee: Systems Engineer ---
PBDefence.com
BudTVNetwork.com
RadioWeedShow.com
"Bringing entertainment to Unix"
"Finding the exit without looking"

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: python manage.py syncdb Error: No module named messages

2012-03-16 Thread Robert Steckroth
Also can I assume, regarding the above question above, that "messages" is
the last thing Django is processing since it is at the
bottom of the list in installed apps? I.e. If I fix the messages error it
might work?

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sitemaps',
'django.contrib.admin',
'django.contrib.admindocs',

'home',
'contact',
'registration',
'captcha_utils',
'registration_app',
'django_authopenid',
'djangobb_forum',
'haystack',
'messages',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)



> --
> Bust0ut, Surgemcgee: Systems Engineer ---
> PBDefence.com
> BudTVNetwork.com
> RadioWeedShow.com
> "Bringing entertainment to Unix"
> "Finding the exit without looking"
>
>


-- 
Bust0ut, Surgemcgee: Systems Engineer ---
PBDefence.com
BudTVNetwork.com
RadioWeedShow.com
"Bringing entertainment to Unix"
"Finding the exit without looking"

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: python manage.py syncdb Error: No module named messages

2012-03-16 Thread Shawn Milochik

Check your PYTHONPATH. Perhaps it's not set right on the CentOS machine.

The Linux distro shouldn't make a difference, nor should the presence of 
Cpanel or MySQL.


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



python manage.py syncdb Error: No module named messages

2012-03-16 Thread Robert Steckroth
Hey Gang, I have a Django project built on a Debian server at home using http://djangobb.org;>DjangoBB.
It is working on the Debain OS but I am having huge problems on the Centos
server. This seams to be the farthest I can go with it. -->
#-->python manage.py syncdb
Error: No module named messages
This probably is a dependency issue with the Cpanel and Mysql. Can any of
you offer some advice or experience?



-- 
Bust0ut, Surgemcgee: Systems Engineer ---
PBDefence.com
BudTVNetwork.com
RadioWeedShow.com
"Bringing entertainment to Unix"
"Finding the exit without looking"

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

2012-03-16 Thread Mike Dewhirst

On 17/03/2012 11:02am, Ben wrote:

I have a NullBooleanField that I would like to show up in my admin
interface as radio buttons with unknown selected by default.

# I have the following simplified files

## models.py ##
class Value(models.Model):
 presence = models.NullBooleanField(default=False)


Have you tried

presence = models.NullBooleanField(default=None)


??




## admin.py ##
PRESENCE_CHOICES = ((True, 'True'), (False, 'False'), (None, 'None') )
class ValueAdmin(admin.ModelAdmin):
 formfield_overrides = {
 models.NullBooleanField: {'widget':
RadioSelect(choices=PRESENCE_CHOICES)}
 }
admin.site.register(Value, ValueAdmin)

This behaves very closely to what I desire, but I don't know what I
could replace the False with in:
presence = models.NullBooleanField(default=False)
in order to make it behave as I would like.

Thanks so much for your time,
Ben R.



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



NullBooleanField default to unknown

2012-03-16 Thread Ben
I have a NullBooleanField that I would like to show up in my admin
interface as radio buttons with unknown selected by default.

# I have the following simplified files

## models.py ##
class Value(models.Model):
presence = models.NullBooleanField(default=False)

## admin.py ##
PRESENCE_CHOICES = ((True, 'True'), (False, 'False'), (None, 'None') )
class ValueAdmin(admin.ModelAdmin):
formfield_overrides = {
models.NullBooleanField: {'widget':
RadioSelect(choices=PRESENCE_CHOICES)}
}
admin.site.register(Value, ValueAdmin)

This behaves very closely to what I desire, but I don't know what I
could replace the False with in:
presence = models.NullBooleanField(default=False)
in order to make it behave as I would like.

Thanks so much for your time,
Ben R.

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



css w/ django

2012-03-16 Thread Clark
Trying to get django pages to recognize a css filehaving trouble
getting all of the correct settings right in the settings.py, urls.py
etc...plus there appears to be several different ways to do this.

I'm on a Mac OSX and I've tried this:

settings.py:
MEDIA_ROOT = 'full-path-to-site-on-machine/documents/mysite/mysite/
media/'
MEDIA_URL = 'media'

urls.py:

from django.conf.urls.defaults import *
from mysite.views import hello, current_datetime, hours_ahead, about
from mysite import settings

urlpatterns = patterns('',
(r'^hello/$', hello),
(r'^time/$', current_datetime),
(r'^time/plus/(\d{1,2})/$', hours_ahead),
(r'^about/$', about),
)
if settings.DEBUG:
urlpatterns += patterns('',
(r'^media/(?P.*)$', 'django.views.static.serve',
 {'document_root': settings.MEDIA_ROOT}),
)

base.html


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: get().delete() does not work, filter().delete() works?

2012-03-16 Thread Rainy


On Friday, March 16, 2012 2:50:25 PM UTC-4, Tom Evans wrote:
>
> 1) You have overridden the delete() method, and you don't call the
>
> super class method
>

Indeed, I had overridden it to create a delete column and forgot about it!
Thanks.  Rainy
 

>

-- 
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/-/8NryXOYixNwJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: get().delete() does not work, filter().delete() works?

2012-03-16 Thread Tom Evans
On Fri, Mar 16, 2012 at 6:33 PM, Rainy  wrote:
> Hi, I have a function that accepts a pk and deletes an object:
>
> Item.objects.filter(pk=pk).delete()
>
> If I change it to:
>
> Item.objects.get(pk=pk).delete()
>
> it no longer works, without any errors. I tried it using exactly the
> same object. I looked at django docs for deletion, the only difference
> they mention is that with .filter(), it will also do bulk deletion.
>
> What is the reason for this behaviour? Thanks!
>

Those are two very different methods, instance.delete() on a model
calls the instance's delete method, which (eventually) via the
Model.delete() method, sends a pre_delete signal, issues a SQL
statement to delete that row from the database and finally issues a
post_delete signal.

queryset.delete() does not do any of that, it simply constructs a
"DELETE FROM ... WHERE ..." query and executes it.

So why does your instance.delete() not work? Top contenders:

1) You have overridden the delete() method, and you don't call the
super class method
2) You have a pre_delete signal that refuses the deletion (altho I
think you would receive an exception in this case?)
3) Something I haven't considered \o/

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.



get().delete() does not work, filter().delete() works?

2012-03-16 Thread Rainy
Hi, I have a function that accepts a pk and deletes an object:

Item.objects.filter(pk=pk).delete()

If I change it to:

Item.objects.get(pk=pk).delete()

it no longer works, without any errors. I tried it using exactly the
same object. I looked at django docs for deletion, the only difference
they mention is that with .filter(), it will also do bulk deletion.

What is the reason for this behaviour? 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: Django prefetch_related string parameter used for reverse lookup is inconsistence.

2012-03-16 Thread Suteepat Damrongyingsupab
Sorry, class Book should be:

class Book(models.Model):
author = models.ForeignKey(Author)
publisher = models.ForeignKey(Publisher)
price = models.DecimalField()

-- 
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/-/EFL4XhsH0O4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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 prefetch_related string parameter used for reverse lookup is inconsistence.

2012-03-16 Thread Suteepat Damrongyingsupab
Given that the following models:

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

class Book(models.Model):
author = models.ForeignKey(Author)
price = models.DecimalField()

class Publisher(models.Model):
name = models.CharField()

In normal query:
Author.objects.filter(book__publisher__name='foo')
Author.objects.aggregate(Avg('book__price'))

In prefetch_related:
Author.objects.prefetch_related('book_set')
or worse
Author.objects.prefetch_related('book_set__publisher')

Is this the intended behaviour for prefetch_related?
I think it should be the same as other query string (without "_set") for 
consistency.

BTW, I was asking this question to the django-developers group but not sure 
that it's appropriate to post there.
What you guys think?

-- 
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/-/uvZ3uuX77MoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Will Django run on z/linux?

2012-03-16 Thread James Bennett
On Fri, Mar 16, 2012 at 12:06 PM, jc  wrote:
> We have a number of z/linux (z/vm s390) Linux servers and would like
> to consider porting this application to one of the instances.  Will it
> run on z?

For Django to run on a platform, you need the following things:

1. The ability to install and run Python.
2. The ability to install and use a database (and Python adapter
module) Django supports.
3. The ability to install and run a web server plus some sort of
gateway/WSGI module to let it talk to Python applications.

So if you can do those things, you can run Django.

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



Re: Will Django run on z/linux?

2012-03-16 Thread David Markey
Yup.. Should be no problem at all.

On 16 March 2012 17:22, Dan Poirier  wrote:

> On Fri. 2012-03-16 at 01:06 PM EDT, jc  wrote:
>
> > We have a number of z/linux (z/vm s390) Linux servers and would like
> > to consider porting this application to one of the instances.  Will it
> > run on z?
>
> It's Linux, so sure.  (Now z/OS would be another story...)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: Will Django run on z/linux?

2012-03-16 Thread Dan Poirier
On Fri. 2012-03-16 at 01:06 PM EDT, jc  wrote:

> We have a number of z/linux (z/vm s390) Linux servers and would like
> to consider porting this application to one of the instances.  Will it
> run on z?

It's Linux, so sure.  (Now z/OS would be another story...)

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



Will Django run on z/linux?

2012-03-16 Thread jc
We have a number of z/linux (z/vm s390) Linux servers and would like
to consider porting this application to one of the instances.  Will it
run on z?


Thanks,

JC

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

2012-03-16 Thread creecode
Hello coded kid,

On Friday, March 16, 2012 2:30:06 AM UTC-7, coded kid wrote:

Hi guys, does anyone know about a good django package for twitter 
> authorization? I tried using omab/django social auth, but the twitter 
> authorization is not working for me.


Are you interested in oAuth capabilities only (authorization) or Twitter 
functionality as a whole (post, delete, etc. )?

If you want a Twitter client take a look at Python Twitter < 
http://code.google.com/p/python-twitter/ >.  I've used it a bit for posting 
and seems to work OK.

Toodle-looo...
creecode

-- 
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/-/BKzWscn6zKkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Djano if statement help

2012-03-16 Thread J. Cliff Dyer
Well the first suspicious thing was that you were testing to see if it
was equal to the string "0".  That tells me you don't understand how
equality works in python.  Python is strongly typed.  Strings and
integers are not the same thing, and will never be equal to one another.
Without more information, we can't really tell what's going on.

Also, if you are expecting the string "Enabled" or "Disabled" to be
passed in to the template, you are overcomplicating things by saying

  {% if EnableLogUpload == "Enabled" %}Enabled{% else %}Disabled{% endif
%}

You could just say

  {{ EnableLogUpload }}

But none of that will solve your problem, because EnableLogUpload is
clearly not set to the string "Enabled".  I can say for sure that you're
passing it in wrong from the view, but I can't say how without seeing
your view code. Please share that as well.

If I were doing it from scratch, I would just make a the EnableLogUpload
variable a boolean, and worry about how I want to render it in the
template.  I would also use standard python naming conventions (because
the most important task of code is to communicate with other
programmers, and only secondarily to make a computer do things).  The
simplified version would look like this:

=== views.py ===

def view(request):
context = {'enable_log_upload': True}
return render('template.html', context)

=== end views.py ===

=== template.html ===

{% if enable_log_upload %}enabled{% else %}disabled{% endif %}

=== end template.html ===

Note that I'm not trying to test if enable_log_upload is equal to
anything in particular.  I just want to know if it's a true value or
not.


On Fri, 2012-03-16 at 07:47 -0700, HarryBoy wrote:
> 
> If I set it to "Enabled" and then check if it is indeed {% if
> EnableLogUpload == "Enabled" %} it does not enter the if statement.
> 
> 
> What am I doing wrong??
> 
> -- 
> 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/-/x6xX1B-NbYcJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: Djano if statement help

2012-03-16 Thread HarryBoy

If I set it to "Enabled" and then check if it is indeed {% if 
EnableLogUpload == "Enabled" %} it does not enter the if statement.
>
>
What am I doing wrong??

-- 
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/-/x6xX1B-NbYcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Djano if statement help

2012-03-16 Thread Joel Goldstick
On Fri, Mar 16, 2012 at 9:25 AM, HarryBoy  wrote:
>> Sorry the '==' was a typo, its actually:
>>
>> EnableLogUpload = "Enabled"
>
> --
> 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/-/Tu0wfrtAPJUJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

on top you check if EnableLogUpload = '1'  Later on you check if it = 'Enabled'


-- 
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: Djano if statement help

2012-03-16 Thread HarryBoy
Anyone?
>
>

-- 
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/-/dOBYPgDjwHcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: A little InlineModelAdmin help please?

2012-03-16 Thread Jeff Blaine
Thanks for the reply, Marc.

On Thursday, March 15, 2012 4:32:48 PM UTC-4, Jeff Blaine wrote:
>
> Easier for me to just draw you a picture:
>
>++
>|   noodle   |
>++
> | |
> | |
>   +-+ ++
>   ||
>   ||
> +---+   +--+
> | foo 1 |   | foo 2|
> |   |   |  |
> | noodle ref|   | noodle ref   |--+
> +---+   +--+  |
>|  |
>|  |
>|  |
> ++  +---+
> | bar 1  |  | bar 2 |
> ||  |   |
> | foo 2 ref  |  | foo 2 ref |
> ++  +---+
>
> I have a ModelAdmin for model "noodle" displaying an
> Inline already of model "foo".  Works fine.
>
> However, I want that existing inline of "foo" to also show
> the associated info from model bar:
>
> NOODLE
> FOO 1   foofield1foofield2
> FOO 2   foofield1foofield2
>   BAR 1barfield1barfield2
>   BAR 2barfield1barfield2
>

-- 
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/-/W_9glP8b-ZAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Theme template designer form

2012-03-16 Thread Alec Taylor
I am creating a website which will allow people to post content with "fluff"!

That is; users will apply choose from a selection of templates to
apply to their content[1] before displaying it on my website.

[1] Content contains no hyperlinks; just images and general
manipulation text manipulation (bold, italic, underline, alignment
[also for images], highlight and text-colour) with full drag-and-drop
support implemented in JavaScript.

Can you recommend some projects and/or modules which will assist in
building this project?

Thanks for all suggestions,

Alec Taylor

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



Re: Djano if statement help

2012-03-16 Thread HarryBoy

>
> Sorry the '==' was a typo, its actually:
> EnableLogUpload = "Enabled"
>
>

-- 
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/-/Tu0wfrtAPJUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Djano if statement help

2012-03-16 Thread Tom Evans
On Fri, Mar 16, 2012 at 1:01 PM, HarryBoy  wrote:
>> Hi, thanks for the reply.
>
>
> I printed the value and its actually 0 every time.
>
> Why is it 0 when I set it to EnableLogUpload == "Enabled"??
>
> Thanks
>

'==' tests equality
'=' assigns a rvalue

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: Djano if statement help

2012-03-16 Thread HarryBoy

>
> Hi, thanks for the reply.


I printed the value and its actually 0 every time.

Why is it 0 when I set it to EnableLogUpload == "Enabled"??

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/-/gCHTpJZlMTIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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-subscription

2012-03-16 Thread Stanwin Siow
Hello,

I was wondering whether there are any links that teaches you how to integrate 
django-subscription into your app in detail?

To give a general view of what i would be doing, i want to integrate the 
django-subscription so i can give recurring billing to my customers.


So far what i have found are documentations on git hub that don't give a clear 
picture.

if there is a better solution i am all ears.


Appreciate any kind of help offered.

Thanks! 

Best Regards,

Stanwin Siow



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

2012-03-16 Thread Joel Goldstick
On Fri, Mar 16, 2012 at 6:00 AM, HarryBoy  wrote:
> I have the following:
>
>               
>                     name="EnableLogUpload" value="true"  {% if EnableLogUpload == '1' %}
> checked="checked" {% endif %} />Enabled
>                     name="EnableLogUpload" value="false" {% if EnableLogUpload == '0' %}
> checked="checked" {% endif %}  />Disabled
>                
>
> Then the following if statement:
> {% if
> EnableLogUpload == '1' %} Enabled  {% else %} Disabled {% endif %}  div>
>
> The above code works as expected (If EnableLogUpload equals to true
> then 'Enabled' is displayed else 'Disabled' is displayed.
>
> But I want to change the 'value' of the radio buttons to "Enabled" and
> "Disabled" instead of "true" and "false" like so:
>   
>                     name="EnableLogUpload" value="Enabled"  {% if EnableLogUpload == '1'
> %} checked="checked" {% endif %} />Enabled
>                     name="EnableLogUpload" value="Disabled" {% if EnableLogUpload == '0'
> %} checked="checked" {% endif %}  />Disabled
>                
>
> But I can't get the  django if statement to work:
> e.g.
> {% if
> EnableLogUpload == "Enabled"  %} Enabled  {% else %} Disabled {% endif
> %} 
>
> This always prints out 'Disabled' even when the EnableLogUpload is
> "Enabled".
>
> Am I doing something incorrect??
>
Try printing the value before you do the test to see if it is what you
think it is

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



-- 
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: Add customize app filed to add user page

2012-03-16 Thread yillkid
Thanks for reply.

Yes I have did it. But my question is add the data to the "add user" page.

It looks link the interface "admin.site.register" but it actually in "user 
add template (/templates/admin/auth/user/add_form),

thanks :)

Joel Goldstick於 2012年3月16日星期五UTC+8下午5時31分13秒寫道:
>
> On Fri, Mar 16, 2012 at 4:52 AM, yillkid  wrote:
> > Hi all:
> >
> > I want add a filed in app to add user page (/admin/auth/user/ ),
> >
> > or
> >
> > Actually I just want to add a valid date (DateTIme Filed) in add user 
> page,
> >
> > and this Filed I have create in UserProfile class already, then how I 
> should
> > do ?
> >
> > 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/-/tbvw5Nc8e9IJ.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, 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 has a way to extend user information with User Profiles.  Here
> is one of the first items that pops up on google:
>
> http://www.turnkeylinux.org/blog/django-profile
>
> If you are using v1.3 here is the section in the docs:
>
> https://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users
>
> Apparently this is an area that is changing in v1.4 so take note
>
> -- 
> Joel Goldstick
>
>
Joel Goldstick於 2012年3月16日星期五UTC+8下午5時31分13秒寫道:
>
> On Fri, Mar 16, 2012 at 4:52 AM, yillkid  wrote:
> > Hi all:
> >
> > I want add a filed in app to add user page (/admin/auth/user/ ),
> >
> > or
> >
> > Actually I just want to add a valid date (DateTIme Filed) in add user 
> page,
> >
> > and this Filed I have create in UserProfile class already, then how I 
> should
> > do ?
> >
> > 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/-/tbvw5Nc8e9IJ.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, 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 has a way to extend user information with User Profiles.  Here
> is one of the first items that pops up on google:
>
> http://www.turnkeylinux.org/blog/django-profile
>
> If you are using v1.3 here is the section in the docs:
>
> https://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users
>
> Apparently this is an area that is changing in v1.4 so take note
>
> -- 
> Joel Goldstick
>
>
Joel Goldstick於 2012年3月16日星期五UTC+8下午5時31分13秒寫道:
>
> On Fri, Mar 16, 2012 at 4:52 AM, yillkid  wrote:
> > Hi all:
> >
> > I want add a filed in app to add user page (/admin/auth/user/ ),
> >
> > or
> >
> > Actually I just want to add a valid date (DateTIme Filed) in add user 
> page,
> >
> > and this Filed I have create in UserProfile class already, then how I 
> should
> > do ?
> >
> > 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/-/tbvw5Nc8e9IJ.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, 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 has a way to extend user information with User Profiles.  Here
> is one of the first items that pops up on google:
>
> http://www.turnkeylinux.org/blog/django-profile
>
> If you are using v1.3 here is the section in the docs:
>
> https://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users
>
> Apparently this is an area that is changing in v1.4 so take note
>
> -- 
> Joel Goldstick
>
>

-- 
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/-/l_Ogrtv9YiAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Djano if statement help

2012-03-16 Thread HarryBoy
I have the following:

   
Enabled
Disabled


Then the following if statement:
{% if
EnableLogUpload == '1' %} Enabled  {% else %} Disabled {% endif %} 

The above code works as expected (If EnableLogUpload equals to true
then 'Enabled' is displayed else 'Disabled' is displayed.

But I want to change the 'value' of the radio buttons to "Enabled" and
"Disabled" instead of "true" and "false" like so:
   
Enabled
Disabled


But I can't get the  django if statement to work:
e.g.
{% if
EnableLogUpload == "Enabled"  %} Enabled  {% else %} Disabled {% endif
%} 

This always prints out 'Disabled' even when the EnableLogUpload is
"Enabled".

Am I doing something incorrect??


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

2012-03-16 Thread yillkid
Thanks for reply ... ... :)

But I have extent my UserProfile class success already.

Now I can find the new column in UserProfile Table in database.

But I want to add this extent data into my "add user" page. and access it.

For example:

I want to add a "valid duration" data  when I add a new user.

And the data have add in UserProfile already, 

but if I want to add the filed on "add user" page, how I should do ?


yillkid於 2012年3月16日星期五UTC+8下午4時52分47秒寫道:
>
> Hi all:
>
> I want add a filed in app to add user page (/admin/auth/user/ ),
>
> or
>
> Actually I just want to add a valid date (DateTIme Filed) in add user page,
>
> and this Filed I have create in UserProfile class already, then how I 
> should do ?
>
> 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/-/RodcjM98wP0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Reports

2012-03-16 Thread Alexey Luchko
We are using PDFs.

-- 
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/-/EfQeowVhrBoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: show ldap attributes in django

2012-03-16 Thread Marc Patermann

Hi,

Marc Patermann schrieb (15.03.2012 16:39 Uhr):


And a template:

{{ text }}

Which gives a dictionary with values of lists where most of the list 
have only one value. I can access single of them by {{ text.mail }} or 
{{ text.mail }}.


My goal is to show whatever attribute there is with its values.
Can you point me in the right directions to achieve this?
I found some hints at 
http://groups.google.com/group/django-users/browse_thread/thread/6f1b957dc5341fbe/4e297f2c9d960fee


Now I have

{% for key in text.items %}
  Attribut Nr. {{ forloop.counter }} {{ key.0 }} hat
  {% for value in  key.1 %}
Wert {{ value }} 
  {% endfor %}
{% endfor %}

in my template, which is fine for now.


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: Add customize app filed to add user page

2012-03-16 Thread Joel Goldstick
On Fri, Mar 16, 2012 at 4:52 AM, yillkid  wrote:
> Hi all:
>
> I want add a filed in app to add user page (/admin/auth/user/ ),
>
> or
>
> Actually I just want to add a valid date (DateTIme Filed) in add user page,
>
> and this Filed I have create in UserProfile class already, then how I should
> do ?
>
> 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/-/tbvw5Nc8e9IJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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 has a way to extend user information with User Profiles.  Here
is one of the first items that pops up on google:

http://www.turnkeylinux.org/blog/django-profile

If you are using v1.3 here is the section in the docs:
https://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users

Apparently this is an area that is changing in v1.4 so take note

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



A good Twitter Package

2012-03-16 Thread coded kid
Hi guys, does anyone know about a good django package for twitter
authorization? I tried using omab/django social auth, but the twitter
authorization is not working for me.

Would love to hear your opinion! 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.



Add customize app filed to add user page

2012-03-16 Thread yillkid
Hi all:

I want add a filed in app to add user page (/admin/auth/user/ ),

or

Actually I just want to add a valid date (DateTIme Filed) in add user page,

and this Filed I have create in UserProfile class already, then how I 
should do ?

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/-/tbvw5Nc8e9IJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Pass model filed to add user page

2012-03-16 Thread yillkid
Hi all :

I want to pass a DateTime Filed to the "add user page" ( /admin/auth/user/ 
),

anyone could give me a clue ? 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/-/JGCg0UAG1C0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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 structure and basic flow

2012-03-16 Thread Daniel Hepper
> I am confused that different tutorial gives different method of doing
> things. I want to know how to setup basic cms site,
> what folder should I create, sometime people create apps, sometimes
> they don't.

There are different ways to structure your project, but if you want to
use the database you have to create at least one app which you add to
INSTALLED_APPS in the settings. You can split the functionality in
multiple apps for easier reuse (often called reusable apps), but
keeping it in one app is simpler in the beginning.

> How do I put this in order?
> 1.url
> 2. view
> 3.model
> 4. template
> 5. admin
> 6. settings

I suggest to closely follow the official tutorial on djangoproject.com
and to use the "django-admin.py startproject" and "python manage.py
startapp" commands. They will create an initial structure to get you
started.

A word of caution: the recommended project structure changes from the
current Django 1.3 to the upcoming Django 1.4. Make sure you look at
the right version of the documentation.

-- Daniel

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Query Set to search for a combination of model fields?

2012-03-16 Thread Guillaume Chorn
Shawn, man thanks!  I actually had no idea about the pipe vs. ampersand
distinction.  I went ahead and changed my code to the following:

def search(request):
query = request.GET.get('q','')
querywords = query.split(' ')
lname=''
for word in querywords[1:-1]:
lname += word+' '
lname += querywords[-1]
if query:
if len(querywords)>1:
qset = (
Q(first_name__icontains=querywords[0]) &
Q(last_name__icontains=lname)|
Q(first_name__icontains=querywords[0])|
Q(last_name__icontains=querywords[0])
)
results = Player.objects.filter(qset).distinct()
results = results.order_by('last_name','first_name')
else:
qset = (
Q(first_name__icontains=querywords[0])|
Q(last_name__icontains=querywords[0])
)
results = Player.objects.filter(qset).distinct()
results = results.order_by('last_name','first_name')
else:
results = []
return render(request,'search.html', {
'results': results,
'query': query,
'querywords':querywords
})

This seems to work; I just need to find a way to separate exact matches
from the rest.  I'm guessing it will involve some logic to forgo the
additional queries if I can find a result for
Q(first_name__exact=querywords[0])
& Q(last_name__exact=lname), but I'm not yet sure how to structure it.

By the way, does anyone know what the default sorting order is for the
results?  You may have noticed I forced a sort order by last name and then
first name, but I find it annoying that I had to do this even though my
primary keys are in this same order.  I thought the default sort order was
by pk?

cheers,
Guillaume

On Fri, Mar 16, 2012 at 11:29 AM, Shawn Milochik  wrote:

> Look at how the Q objects are being used in the example and it's clear why
> that is. It's using the pipe (|) to do an "or" query.
>
> If you want to change how the search works you'll have to add more code:
>
> 1. Split the search parameters on whitespace.
> 2. Create Q objects for searching in either or both fields for the values
> and use pipe (|) and ampersand (&) to "or" or "and" them as needed.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django 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: Query Set to search for a combination of model fields?

2012-03-16 Thread Matthias Kestenholz
On Fri, Mar 16, 2012 at 04:29, Shawn Milochik  wrote:
> Look at how the Q objects are being used in the example and it's clear why
> that is. It's using the pipe (|) to do an "or" query.
>
> If you want to change how the search works you'll have to add more code:
>
> 1. Split the search parameters on whitespace.
> 2. Create Q objects for searching in either or both fields for the values
> and use pipe (|) and ampersand (&) to "or" or "and" them as needed.
>

Maybe this code will help you forward:

https://github.com/matthiask/towel/blob/master/towel/managers.py

It supports grouping ("term1 term2"), inclusion ("term" or "+term")
and exclusion ("-term") too.


Matthias

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