Re: Accessing tuple element in templatetag, / Generating multi-level lists.

2011-09-10 Thread Petey
Thanks for your responses.

How I can generate multilevel lists based on fields:
category
 - subcategory


-- 
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/-/qSXTwcrHAcIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Admin Site appending letter "s" to end of each model\table name

2011-09-10 Thread Shawn Milochik

On 09/10/2011 11:55 PM, Gil wrote:
I'm a newbie to object-oriented programming too, so I suppose my 
mindset is still in procedural, SQL and "recordset" modes, and 
otherwise: my old ways :-) Thanks for that additional info. Good Points.

*From:* Shawn Milochik **


You're welcome. The way you were doing it makes perfect sense if you 
have experience creating database tables by hand, the way most people do 
for their PHP and ASP apps. Django's ORM is doing all the same stuff 
underneath, but it provides a level of abstraction that makes it (much) 
easier to do common things, and it's a bit different than the "old way."



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



Re: Admin Site appending letter "s" to end of each model\table name

2011-09-10 Thread Gil
I'm a newbie to object-oriented programming too, so I suppose my mindset is 
still in procedural, SQL and "recordset" modes, and otherwise: my old ways 
:-) Thanks for that additional info. Good Points.

From: Shawn Milochik 
To: django-users@googlegroups.com
Sent: Saturday, September 10, 2011 6:12 PM
Subject: Re: Admin Site appending letter "s" to end of each model\table name



>It's conventional to name model in the singular by default, such as Movie and 
>Book. You have a 'Movie' model, not a 'Movies' model. It also makes the 
>default in the admin make perfect sense. If you have something that does end 
>in is or the plural doesn't end in S (ox/oxen) then use verbose_name_plural.
>
>If you think about it, a "Movies" doesn't have a "title" and "year_released" 
>and a "rating" -- a "Movie" does.
>-- 
>You received this message because you are subscribed to the Google Groups 
>"Django users" group.
>To post to this group, send email to django-users@googlegroups.com.
>To unsubscribe from this group, 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: newbie question on activating the automatic admin

2011-09-10 Thread Babatunde Akinyanmi
Hi nara,
Please post the debug output you get when you try to view the admin
page from your browser.

Meanwhile, while switching versions of django, you have to make sure
you remove completely every file from the old version. Failure to do
that will break django.

On 9/10/11, nara  wrote:
> ok, I switched to the 1.3.1 released version of Django, and
> also tried Python2.6 instead of Python2.7 on the dev version
> of Django. Things are still majorly broken, see the following
> in the django shell on a fresh startproject, I could not
> import even the top level django module. Then,
> I set PYTHONPATH to /home/nara/Django1.3/django,
> and after that, in the shell, I am still unable to
> directly import the admin module, I have to do this:
>
 import django
 import django.contrib
 import django.contrib.admin
>
> So, the problem is not just in the admin module, it
> is likely all over the place (entire django module hierarchy).
>
> Oh well, looks like I have to cool this off for a while.
>
> Thanks for everyone's help.
> Nara
>
>
>
>
> On Sep 10, 2:17 pm, nara  wrote:
>> I'll get through this yet :)
>>
>> I tried the commands you have under the django shell, and I got
>> 'example.com'
>> on the django.Site query, and not an error. Also, interestingly,
>> within the shell, I don't see
>> django on the sys.path at all (shown below), but I do see my project
>> mblog. This could
>> be the cause of not seeing the admin. I could switch to python 2.6
>> instead
>> of python 2.7, but I doubt that that is going fix this issue. Dropping
>> my project
>> table and doing a new syncdb did not help either.
>>
>> Here is the path, prettified:
>>
>> ['/home/nara/dj/mblog'
>>  '/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg'
>>  '/usr/local/lib/python2.7/dist-packages/grin-1.2.1-py2.7.egg'
>>  '/usr/local/lib/python2.7/dist-packages/pip-1.0.2-py2.7.egg'
>>  '/usr/lib/python2.7'
>>  '/usr/lib/python2.7/plat-linux2'
>>  '/usr/lib/python2.7/lib-tk'
>>  '/usr/lib/python2.7/lib-old'
>>  '/usr/lib/python2.7/lib-dynload'
>>  '/usr/local/lib/python2.7/dist-packages'
>>  '/usr/lib/python2.7/dist-packages'
>>  '/usr/lib/python2.7/dist-packages/PIL'
>>  '/usr/lib/pymodules/python2.7/gtk-2.0'
>>  '/usr/lib/python2.7/dist-packages/gst-0.10'
>>  '/usr/lib/python2.7/dist-packages/gtk-2.0'
>>  '/usr/lib/pymodules/python2.7'
>>  '/usr/lib/pymodules/python2.7/ubuntuone-control-panel'
>>  '/usr/lib/pymodules/python2.7/libubuntuone'
>>  '/usr/lib/pymodules/python2.7/ubuntuone-storage-protocol'
>>  '/usr/lib/pymodules/python2.7/ubuntuone-client']
>>
>> Thanks
>> Nara
>>
>> On Sep 9, 9:56 pm, Babatunde Akinyanmi  wrote:
>>
>>
>>
>>
>>
>>
>>
>> > Hi nara,
>> > This error is normally thrown when the sites app is being used in a
>> > django project. I think it can also occur if the sites tables in the
>> > database is not properly created during django-admin startproject.
>> > Someone else reported that he was able to solve the problem by using a
>> > user name without special characters.
>>
>> > This might be difficult to debug since you are using a development
>> > version however:
>> > 1. Go to the inbuilt django shell and enter these commands:
>> > from django.contrib.sites.models import Site
>> > From django.conf import settings
>> > x = settings.SITE_ID
>> > Site.objects.get(pk=x)
>>
>> > You should get the same "site matching query does not exist" error.
>> > Now print x and then check the django_site_table in your database. x
>> > should be the same as the primary key of what you have in the table.
>> > If it isn't, drop the table and syncdb again.
>>
>> > On 9/10/11, nara  wrote:
>>
>> > > yes, admin is in INSTALLED_APPS. BTW, the basic site works fine if I
>> > > turn
>> > > off all admin. admin is not strictly necessary, it is just a nicety.
>>
>> > > One strange thing though: I have had to set PYTHONPATH and
>> > > explicitly set it to ~/mblog:~/mblog/apps:~/mblog/apps/myblog,
>> > > even though __init__.py files exist at all levels! Could
>> > > something as basic as Python module search be broken?
>> > > I am using latest Python 2.7 on Ubuntu 11.04
>>
>> > > Thanks
>> > > Nara
>>
>> > > On Sep 9, 5:35 pm, Casey Greene  wrote:
>> > >> Is admin in INSTALLED_APPS?
>>
>> > >>https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-INSTA...
>>
>> > >> Casey
>>
>> > >> On 09/09/2011 07:04 PM, nara wrote:
>>
>> > >> > Hi,
>>
>> > >> > I am a newbie, and I am trying a very basic blog site to get
>> > >> > familiar
>> > >> > with the latest development release. I followed the directions in
>> > >> > the
>> > >> > tutorial (part 2) to try and get the automatic admin going.
>> > >> > However,
>> > >> > here is what I get on the url localhost:8000/admin/
>>
>> > >> > DoesNotExist at /admin/
>>
>> > >> > Site matching query does not exist.
>>
>> > >> > Request Method:    GET
>> > >> > Request URL:      

Re: Norwegian Sorting

2011-09-10 Thread Lachlan Musicman
I don't know if this is the exact problem, but I've addressed this
previously here:

http://www.pineappledonut.org/2010/12/05/data-collations/

I've only worked with MySQL before, so I'm not sure about how
collations work in POSTGres, but it may provide some pointers.

cheers
L.

On Sat, Sep 10, 2011 at 15:49, Иван Иванов  wrote:
> На Fri, 09 Sep 2011 22:18:50 +0100
> Tim Sawyer  написа:
>
>> Hi Folks,
>>
>> I have a django site which is against a postgres database which is
>> UTF8. I have a large droplist with international names in, and it
>> doesn't appear to be sorting correctly.
>>
>> The list contains Ingvar Mæland and Børre Børresen.  I'm told that
>> the Norwegian sort order should be X Y Z Æ Ø Å.  That's not what I'm
>> seeing
>> - I think it's just sorting them as A's.
>>
>> I found Ingvar Mæland in the place I would expect to find Maland
>>
>> I found Børre Børresen in the place I would expect to find Barresen
>>
>> LANGUAGE_CODE = 'en-gb', in settings.py.
>>
>> Does anyone know what I've missed?
>
> You probably have problem in the postgres itself. I had simmilar
> problems with mysql, where it returns "a" and "a" with some diacritical
> mark when I do select with where clause which searches for one of them.
>
> So better try to make the same query directly in some postgres client
> to see if the result is broken.
>
> And here two mails, which discuss your problem from other mailing lists:
> http://archives.postgresql.org/pgsql-novice/2007-09/msg00066.php
> http://freebsd.1045724.n5.nabble.com/Enabling-norwegian-sorting-rules-in-PostgreSQL-td4256621.html
>
>> Thanks,
>>
>> Tim.
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
The politician’s syllogism, also known as the politician’s logic or
the politician’s fallacy, is a logical fallacy of the form:
- We must do something
- This is something
- Therefore, we must do this.
(via http://bestofwikipedia.tumblr.com/ )

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



[ANNOUNCE] Django 1.2.7 -- corrects issue with 1.2.6 release package

2011-09-10 Thread James Bennett
Due to an issue with yesterday's 1.2.6 release package, today we are
issuing Django 1.2.7. All users of 1.2.X Django should upgrade to
1.2.7, rather than to 1.2.6.

Details here:

https://www.djangoproject.com/weblog/2011/sep/10/127/


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Admin Site appending letter "s" to end of each model\table name

2011-09-10 Thread Shawn Milochik

On 09/10/2011 07:46 PM, gillwill2...@yahoo.com wrote:
It was only a problem  insofar as I didn't like the way such a listing 
looked, particulalrly when I have several models that already, 
originally, have an "s" at the end of their name like "Movies", 
"Books", etc... which would then be listed as "Moviess", "Bookss"...  
and removing the "s" from their class names in models.py would require 
many code changes elsewhere in the app.

Anyway, thanks to all for the solution:
The verbose_name & verbose_name_plural did the trick.
-Gil



It's conventional to name model in the singular by default, such as 
Movie and Book. You have a 'Movie' model, not a 'Movies' model. It also 
makes the default in the admin make perfect sense. If you have something 
that does end in is or the plural doesn't end in S (ox/oxen) then use 
verbose_name_plural.


If you think about it, a "Movies" doesn't have a "title" and 
"year_released" and a "rating" -- a "Movie" does.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Admin Site appending letter "s" to end of each model\table name

2011-09-10 Thread gillwill2...@yahoo.com
It was only a problem  insofar as I didn't like the way such a listing looked, 
particulalrly when I have several models that already, originally, have an "s" 
at the end of their name like "Movies", "Books", etc... which would then be 
listed as "Moviess", "Bookss"...  and removing the "s" from their class names 
in models.py would require many code changes elsewhere in the app.
 Anyway, thanks to all for the solution:
 
The verbose_name & verbose_name_plural did the trick.
 
-Gil
 
P.S.
 
I am basically a newbie at Django & Python so not sure I completely understand 
"localized model names" vs "english names". My model class names are just 
matches to the mysql database table names.

From: Michał Sawicz 
To: django-users@googlegroups.com
Sent: Saturday, September 10, 2011 3:52 PM
Subject: Re: Admin Site appending letter "s" to end of each model\table name

First, why is that a problem? If you're using localized model names and
that's where that doesn't fit - you shouldn't, really. You should use
english names for the models and use the i18n infrastructure [1] to
translate the names properly.

Either way [2] and [3] is what you need.

[1] https://docs.djangoproject.com/en/1.3/howto/i18n/
[2]
https://docs.djangoproject.com/en/1.3/ref/models/options/#verbose-name
[3]
https://docs.djangoproject.com/en/1.3/ref/models/options/#verbose-name-plural

Cheers,
-- 
Michał (Saviq) Sawicz 

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



Use of threading.local() ... what is the risk?

2011-09-10 Thread Micah Carrick
I have read https://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser and
numerous other discussions about the use of threading.local() yet I still
see it being employed in various projects.

I have recently implemented a referral system in which the use of
threading.local() makes the app very portable and very simple as I can
simply use the post_save signal (which cannot access the session). What I'm
doing...

1. When a user first gets to the site, middleware stores the referral ID
found in the URL and puts it into a session variable.
2. The session variable is copied to a threading.local() variable on every
request.
3. A handler for the post_save on the User model checks this
threading.local() variable, finds the User the referral code belongs to, and
associates the referral user with the referred user in referral model. This
handler also creates the referral code for the new user.

I like this approach because there is no need to think about the referral
system in the views, forms, or models of the auth system. I haven't deployed
this because of the big threading.local() warnings.

So this referral code is the only thing vulnerable here. This code is a
uniquely generated code which is associated with a User. What risks does
this pose and why?

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



Implementing a List of Foreign Keys in a Model

2011-09-10 Thread Kurtis
Hey Guys,

I have a very simple stub of a project. I'm trying to do something
that should be very simple but isn't as easy as I hoped.

I have a UserProfile class. This object is basically just an extension
of the standard User Class. Within my UserProfile class, I want to
have a list of PublicProfile foreign keys. PublicProfile itself is an
abstract class with multiple classes extending it. For example, a User
can create an ArtistProfile, a BandProfile, etc...

To give you a sense of what I'm trying to accomplish from a user's
perspective: A user can sign up and create multiple Pages (represented
as PublicProfile) for bands, artists, etc...

Here's some simple code I started with but I have no idea how to
proceed:

###

class UserProfile(models.Model):

# The Associated User
user = models.OneToOneField(User)

# The User's Profiles
# What do I do here? I don't know how to start out with an empty
list and add
# ForeignKeys to it as I go.
# profiles = ...?

class PublicProfile(models.Model):

username = models.CharField(max_length = 40)
zipcode = models.CharField(max_length = 10)
# 

class Meta:
abstract = True

class ArtistProfile(PublicProfile):
pass

class BandProfile(PublicProfile):
pass

###

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: Admin Site appending letter "s" to end of each model\table name

2011-09-10 Thread Andres Reyes
Actually the solution is to define a verbose_name and a verbose_name_plural
in your model's Meta

class MyModel(models.Model):
field = models.CharField(max_length=200)

class Meta:
verbose_name = 'My model's name'
verbose_name_plural = 'My model's name in plural context'


El sábado 10 de septiembre de 2011, Christian Ramsey escribió:

> I believe you can use :
>
>   def __unicode__(self)
>
>   return 'Name you'd like without the s'
>
> for each model and this will be used instead.
>
> On 10 Sep 2011, at 14:40, Gillwill wrote:
>
> Apparently the Django default is to append the letter "s" to the end
> of the model name for each listed under a given application on the
> Site Administration page. (It does this in the tutorial sample site as
> well - e.g. naming "poll" "polls", etc...)
>
> Is there any way to get rid of that?
>
> I would think there would be, but I've yet to find in the default
> admin templates or code where it is doing this.
>
> Any help appreciated.
>
> -Gil
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to 
> django-users@googlegroups.com 'django-users@googlegroups.com');>
> .
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com  '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 'django-users@googlegroups.com');>
> .
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com  'django-users%2bunsubscr...@googlegroups.com');>.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Admin Site appending letter "s" to end of each model\table name

2011-09-10 Thread Michał Sawicz
Dnia 2011-09-10, sob o godzinie 14:50 -0700, Christian Ramsey pisze:

> def __unicode__(self)
>   return 'Name you'd like without the s'
> for each model and this will be used instead.
That's obviously not what he's after.


> On 10 Sep 2011, at 14:40, Gillwill wrote:

> >Apparently the Django default is to append the letter "s" to the end
> > of the model name for each listed under a given application on the
> > Site Administration page. (It does this in the tutorial sample site
> > as
> > well - e.g. naming "poll" "polls", etc...)
> > 
> > Is there any way to get rid of that?

First, why is that a problem? If you're using localized model names and
that's where that doesn't fit - you shouldn't, really. You should use
english names for the models and use the i18n infrastructure [1] to
translate the names properly.

Either way [2] and [3] is what you need.

[1] https://docs.djangoproject.com/en/1.3/howto/i18n/
[2]
https://docs.djangoproject.com/en/1.3/ref/models/options/#verbose-name
[3]
https://docs.djangoproject.com/en/1.3/ref/models/options/#verbose-name-plural

Cheers,
-- 
Michał (Saviq) Sawicz 


signature.asc
Description: This is a digitally signed message part


open source social platform

2011-09-10 Thread madprops
y0

I have just published an application that serves as a social platform
to share stuff to anyone in channels. It has one single textbox,  it's
command driven, it's completely ajax based, and is open for a lot of
modifications and improvements.

You can check it out here www.gsyko.com

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



Re: newbie question on activating the automatic admin

2011-09-10 Thread nara
ok, I switched to the 1.3.1 released version of Django, and
also tried Python2.6 instead of Python2.7 on the dev version
of Django. Things are still majorly broken, see the following
in the django shell on a fresh startproject, I could not
import even the top level django module. Then,
I set PYTHONPATH to /home/nara/Django1.3/django,
and after that, in the shell, I am still unable to
directly import the admin module, I have to do this:

>>> import django
>>> import django.contrib
>>> import django.contrib.admin

So, the problem is not just in the admin module, it
is likely all over the place (entire django module hierarchy).

Oh well, looks like I have to cool this off for a while.

Thanks for everyone's help.
Nara




On Sep 10, 2:17 pm, nara  wrote:
> I'll get through this yet :)
>
> I tried the commands you have under the django shell, and I got
> 'example.com'
> on the django.Site query, and not an error. Also, interestingly,
> within the shell, I don't see
> django on the sys.path at all (shown below), but I do see my project
> mblog. This could
> be the cause of not seeing the admin. I could switch to python 2.6
> instead
> of python 2.7, but I doubt that that is going fix this issue. Dropping
> my project
> table and doing a new syncdb did not help either.
>
> Here is the path, prettified:
>
> ['/home/nara/dj/mblog'
>  '/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg'
>  '/usr/local/lib/python2.7/dist-packages/grin-1.2.1-py2.7.egg'
>  '/usr/local/lib/python2.7/dist-packages/pip-1.0.2-py2.7.egg'
>  '/usr/lib/python2.7'
>  '/usr/lib/python2.7/plat-linux2'
>  '/usr/lib/python2.7/lib-tk'
>  '/usr/lib/python2.7/lib-old'
>  '/usr/lib/python2.7/lib-dynload'
>  '/usr/local/lib/python2.7/dist-packages'
>  '/usr/lib/python2.7/dist-packages'
>  '/usr/lib/python2.7/dist-packages/PIL'
>  '/usr/lib/pymodules/python2.7/gtk-2.0'
>  '/usr/lib/python2.7/dist-packages/gst-0.10'
>  '/usr/lib/python2.7/dist-packages/gtk-2.0'
>  '/usr/lib/pymodules/python2.7'
>  '/usr/lib/pymodules/python2.7/ubuntuone-control-panel'
>  '/usr/lib/pymodules/python2.7/libubuntuone'
>  '/usr/lib/pymodules/python2.7/ubuntuone-storage-protocol'
>  '/usr/lib/pymodules/python2.7/ubuntuone-client']
>
> Thanks
> Nara
>
> On Sep 9, 9:56 pm, Babatunde Akinyanmi  wrote:
>
>
>
>
>
>
>
> > Hi nara,
> > This error is normally thrown when the sites app is being used in a
> > django project. I think it can also occur if the sites tables in the
> > database is not properly created during django-admin startproject.
> > Someone else reported that he was able to solve the problem by using a
> > user name without special characters.
>
> > This might be difficult to debug since you are using a development
> > version however:
> > 1. Go to the inbuilt django shell and enter these commands:
> > from django.contrib.sites.models import Site
> > From django.conf import settings
> > x = settings.SITE_ID
> > Site.objects.get(pk=x)
>
> > You should get the same "site matching query does not exist" error.
> > Now print x and then check the django_site_table in your database. x
> > should be the same as the primary key of what you have in the table.
> > If it isn't, drop the table and syncdb again.
>
> > On 9/10/11, nara  wrote:
>
> > > yes, admin is in INSTALLED_APPS. BTW, the basic site works fine if I
> > > turn
> > > off all admin. admin is not strictly necessary, it is just a nicety.
>
> > > One strange thing though: I have had to set PYTHONPATH and
> > > explicitly set it to ~/mblog:~/mblog/apps:~/mblog/apps/myblog,
> > > even though __init__.py files exist at all levels! Could
> > > something as basic as Python module search be broken?
> > > I am using latest Python 2.7 on Ubuntu 11.04
>
> > > Thanks
> > > Nara
>
> > > On Sep 9, 5:35 pm, Casey Greene  wrote:
> > >> Is admin in INSTALLED_APPS?
>
> > >>https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-INSTA...
>
> > >> Casey
>
> > >> On 09/09/2011 07:04 PM, nara wrote:
>
> > >> > Hi,
>
> > >> > I am a newbie, and I am trying a very basic blog site to get familiar
> > >> > with the latest development release. I followed the directions in the
> > >> > tutorial (part 2) to try and get the automatic admin going. However,
> > >> > here is what I get on the url localhost:8000/admin/
>
> > >> > DoesNotExist at /admin/
>
> > >> > Site matching query does not exist.
>
> > >> > Request Method:    GET
> > >> > Request URL:      http://localhost:8000/admin/
> > >> > Django Version:    1.4 pre-alpha SVN-16741
> > >> > Exception Type:    DoesNotExist
> > >> > Exception Value:
>
> > >> > Site matching query does not exist.
>
> > >> > Further, syncdb, even on a brand new database, does not create tables
> > >> > for the admin, just for django and my blog model.
>
> > >> > Ideas, suggestions?
>
> > >> > Thanks
> > >> > Nara
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > 

Re: Admin Site appending letter "s" to end of each model\table name

2011-09-10 Thread Christian Ramsey
I believe you can use :

  def __unicode__(self)
return 'Name you'd like without the s'
for each model and this will be used instead.

On 10 Sep 2011, at 14:40, Gillwill wrote:

> Apparently the Django default is to append the letter "s" to the end
> of the model name for each listed under a given application on the
> Site Administration page. (It does this in the tutorial sample site as
> well - e.g. naming "poll" "polls", etc...)
> 
> Is there any way to get rid of that?
> 
> I would think there would be, but I've yet to find in the default
> admin templates or code where it is doing this.
> 
> Any help appreciated.
> 
> -Gil
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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.



Admin Site appending letter "s" to end of each model\table name

2011-09-10 Thread Gillwill
Apparently the Django default is to append the letter "s" to the end
of the model name for each listed under a given application on the
Site Administration page. (It does this in the tutorial sample site as
well - e.g. naming "poll" "polls", etc...)

Is there any way to get rid of that?

I would think there would be, but I've yet to find in the default
admin templates or code where it is doing this.

Any help appreciated.

-Gil

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

2011-09-10 Thread nara
I'll get through this yet :)

I tried the commands you have under the django shell, and I got
'example.com'
on the django.Site query, and not an error. Also, interestingly,
within the shell, I don't see
django on the sys.path at all (shown below), but I do see my project
mblog. This could
be the cause of not seeing the admin. I could switch to python 2.6
instead
of python 2.7, but I doubt that that is going fix this issue. Dropping
my project
table and doing a new syncdb did not help either.

Here is the path, prettified:

['/home/nara/dj/mblog'
 '/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg'
 '/usr/local/lib/python2.7/dist-packages/grin-1.2.1-py2.7.egg'
 '/usr/local/lib/python2.7/dist-packages/pip-1.0.2-py2.7.egg'
 '/usr/lib/python2.7'
 '/usr/lib/python2.7/plat-linux2'
 '/usr/lib/python2.7/lib-tk'
 '/usr/lib/python2.7/lib-old'
 '/usr/lib/python2.7/lib-dynload'
 '/usr/local/lib/python2.7/dist-packages'
 '/usr/lib/python2.7/dist-packages'
 '/usr/lib/python2.7/dist-packages/PIL'
 '/usr/lib/pymodules/python2.7/gtk-2.0'
 '/usr/lib/python2.7/dist-packages/gst-0.10'
 '/usr/lib/python2.7/dist-packages/gtk-2.0'
 '/usr/lib/pymodules/python2.7'
 '/usr/lib/pymodules/python2.7/ubuntuone-control-panel'
 '/usr/lib/pymodules/python2.7/libubuntuone'
 '/usr/lib/pymodules/python2.7/ubuntuone-storage-protocol'
 '/usr/lib/pymodules/python2.7/ubuntuone-client']

Thanks
Nara


On Sep 9, 9:56 pm, Babatunde Akinyanmi  wrote:
> Hi nara,
> This error is normally thrown when the sites app is being used in a
> django project. I think it can also occur if the sites tables in the
> database is not properly created during django-admin startproject.
> Someone else reported that he was able to solve the problem by using a
> user name without special characters.
>
> This might be difficult to debug since you are using a development
> version however:
> 1. Go to the inbuilt django shell and enter these commands:

> from django.contrib.sites.models import Site
> From django.conf import settings
> x = settings.SITE_ID
> Site.objects.get(pk=x)
>
> You should get the same "site matching query does not exist" error.
> Now print x and then check the django_site_table in your database. x
> should be the same as the primary key of what you have in the table.
> If it isn't, drop the table and syncdb again.
>
> On 9/10/11, nara  wrote:
>
>
>
>
>
>
>
>
>
> > yes, admin is in INSTALLED_APPS. BTW, the basic site works fine if I
> > turn
> > off all admin. admin is not strictly necessary, it is just a nicety.
>
> > One strange thing though: I have had to set PYTHONPATH and
> > explicitly set it to ~/mblog:~/mblog/apps:~/mblog/apps/myblog,
> > even though __init__.py files exist at all levels! Could
> > something as basic as Python module search be broken?
> > I am using latest Python 2.7 on Ubuntu 11.04
>
> > Thanks
> > Nara
>
> > On Sep 9, 5:35 pm, Casey Greene  wrote:
> >> Is admin in INSTALLED_APPS?
>
> >>https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-INSTA...
>
> >> Casey
>
> >> On 09/09/2011 07:04 PM, nara wrote:
>
> >> > Hi,
>
> >> > I am a newbie, and I am trying a very basic blog site to get familiar
> >> > with the latest development release. I followed the directions in the
> >> > tutorial (part 2) to try and get the automatic admin going. However,
> >> > here is what I get on the url localhost:8000/admin/
>
> >> > DoesNotExist at /admin/
>
> >> > Site matching query does not exist.
>
> >> > Request Method:    GET
> >> > Request URL:      http://localhost:8000/admin/
> >> > Django Version:    1.4 pre-alpha SVN-16741
> >> > Exception Type:    DoesNotExist
> >> > Exception Value:
>
> >> > Site matching query does not exist.
>
> >> > Further, syncdb, even on a brand new database, does not create tables
> >> > for the admin, just for django and my blog model.
>
> >> > Ideas, suggestions?
>
> >> > Thanks
> >> > Nara
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Sent from my mobile device

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



Re: Accessing tuple element in templatetag, / Generating multi-level lists.

2011-09-10 Thread uidless
Try this one for 1 question: {{object.get_FIELDNAME_display}} - for you it 
will be look like this {{ c.get_category_display }}

-- 
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/-/DVVg3737jMAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Accessing tuple element in templatetag, / Generating multi-level lists.

2011-09-10 Thread galgal
Also look here: 
https://docs.djangoproject.com/en/1.3/ref/models/instances/#django.db.models.Model.get_FOO_display

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



SCGI error

2011-09-10 Thread Brian Myers
It seems I am getting an error from the WSGI server after all. As a reminder, 
my uwsgi process is started from upstart like this:

exec python /var/www/NurseTriage/triagedb/manage.py runfcgi protocol=scgi 
method=threaded host=127.0.0.1 port = 3033

When I use Firefox to browse to 127.0.0.1:3033, I get this error message:

XML Parsing Error: undefined entity
Location: 
jar:file:///usr/lib/firefox-3.6.21/chrome/toolkit.jar!/content/global/netError.xhtml
Line Number 60, Column 12:
---^

Any ideas what this means? I get the same error with uWSGI. Is this a Firefox 
error?

Thanx,

Brian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Accessing tuple element in templatetag, / Generating multi-level lists.

2011-09-10 Thread galgal
maybe try:
 {%for c in category.elements %}

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



Re: new at this -- need some guidance

2011-09-10 Thread Felipe Lopez
2011/9/10 Danny Gale 

> Daniel, thank you very much. That's extremely helpful.
>
> What I'm trying to define is that every song can be on one album, but each
> album can (of course) have many songs. For that, would it be better to use
> the ManyToMany from Album to song or FK from song to album?
>

FK from Song to Album.

The Django Tutorial has a good example on how to use this relationship: a
Poll has many Choices.

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


-- 
Luis Felipe López Acevedo
IntrosMedia 

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



Accessing tuple element in templatetag, / Generating multi-level lists.

2011-09-10 Thread Petey

In my model I use: choices=CATEGORY_CHOICES property. 

CATEGORY_CHOICES = (
('hw', "Hardware"),
('soft', "Software"),
('snd', 'Audio'),
)
In templatetags it looks like this:
 {%for c in category %}
{{ c.category|title}}

{%endfor%}
It always generates ''hw', 'soft' etc instead of Hardware, Software. I have 
no clue how to access "full-name" for my choices.


2. My second problem is that I dont really understand how I can generate 
multi-level lists.
{{ c.category }}
 - {{ c.subcategory }}
Could someone explain how the loops should look like?

/// Petey

-- 
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/-/TP1GIDGFCDcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: If anyone needs a Django pay check

2011-09-10 Thread Robert Steckroth
Well, I am willing to go to the Big Nerd Ranch or other hard core fast pace
Django
learning course. I have a excellent understanding of programming and will
excel very
quickly. I am willing to invest in your future if you are willing to invest
in mine.
I would love to talk about my background and goals with someone who has
already
accomplished them.  Sincerely Robert Edward Steckroth II
-- 
Bringing game to younix
Bust0ut Entertainment  ---
PBDefence.com
"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: new at this -- need some guidance

2011-09-10 Thread Martin Melin
On Sat, Sep 10, 2011 at 8:36 PM, Danny Gale  wrote:
> Daniel, thank you very much. That's extremely helpful.
>
> What I'm trying to define is that every song can be on one album, but each
> album can (of course) have many songs. For that, would it be better to use
> the ManyToMany from Album to song or FK from song to album?

If a song can only belong to one album, you don't have a many-to-many
relationship between songs and albums, you have a many-to-one
relationship. In Django, you use ForeignKey to define this (on the
Song model).

Check out 
https://docs.djangoproject.com/en/dev/topics/db/models/#many-to-one-relationships
if you're curious.

Cheers,
Martin Melin

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



Re: new at this -- need some guidance

2011-09-10 Thread Danny Gale
Daniel, thank you very much. That's extremely helpful. 

What I'm trying to define is that every song can be on one album, but each 
album can (of course) have many songs. For that, would it be better to use 
the ManyToMany from Album to song or FK from song to album?

-- 
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/-/xQ5cLEmcdlAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: If anyone needs a Django pay check

2011-09-10 Thread Carlos Daniel Ruvalcaba Valenzuela
Following the thread, we at Blackchair Software are also looking for django
developers in the near future so if anyone would like to send their resume.

Regards,
Carlos Daniel Ruvalcaba
Blackchair Software

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

2011-09-10 Thread Cal Leeming [Simplicity Media Ltd]
Just to follow up on this, Simplicity Media is also looking to take on
further Python/Django developers in the near future. We've got the point
where we are having to turn down work, so if you are interested, please send
across your portfolio/resume/linkedin etc.

Thanks

Cal

On Sat, Sep 10, 2011 at 6:05 PM, Robert Steckroth  wrote:

> Hey there gang. If any of you are in need of employment, there
> is some quality job positions available with good pay for any decent
> Django programmers. The consulting firm is based out of St. Paul
> Minnesota and can allow you to work from home. The web site is
> http://www.comfychairconsulting.com/
> Only serious Django coders are needed! Either contact
> the company via the provided web site link or I can
> put you in contact with the right people. Thanks.
>
> --
> Bringing game to younix
> Bust0ut Entertainment  ---
> PBDefence.com
> "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.
>

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



If anyone needs a Django pay check

2011-09-10 Thread Robert Steckroth
Hey there gang. If any of you are in need of employment, there
is some quality job positions available with good pay for any decent
Django programmers. The consulting firm is based out of St. Paul
Minnesota and can allow you to work from home. The web site is
http://www.comfychairconsulting.com/
Only serious Django coders are needed! Either contact
the company via the provided web site link or I can
put you in contact with the right people. Thanks.

-- 
Bringing game to younix
Bust0ut Entertainment  ---
PBDefence.com
"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: new at this -- need some guidance

2011-09-10 Thread Daniel Roseman


On Saturday, 10 September 2011 05:46:33 UTC+1, Danny wrote:
>
> Hi, I'm learning Django (albeit slowly) and I'm trying to set up a really 
> simple database. I want to have Artists, Albums, and Tracks. I want to be 
> able to navigate both ways in the db. So you should be able to go from 
> artist -> album or from album -> artist. Same thing with album and track. I 
> really can't figure it out. Here's the simplest test case I can come up 
> with:
>
> class Song(models.Model):
> album   = models.ForeignKey('Album')
>
> class Album(models.Model):
> tracks  = models.ManyToManyField(Song)
>
> when i run syncdb, it comes up with the following error:
> music.album: Reverse query name for m2m field 'tracks' clashes with field 
> 'Song.album'. Add a related_name argument to the definition for 'tracks'.
>
> So I go back and add the related_name argument:
> class Song(models.Model):
> album   = models.ForeignKey('Album')
>
> class Album(models.Model):
> tracks  = models.ManyToManyField(Song, related_name='album')
>
> and run syncdb again:
> music.album: Accessor for m2m field 'tracks' clashes with field 
> 'Song.album'. Add a related_name argument to the definition for 'tracks'.
> music.album: Reverse query name for m2m field 'tracks' clashes with field 
> 'Song.album'. Add a related_name argument to the definition for 'tracks'.
>
> uh oh. Now there's *TWO* errors!!! What am I doing wrong?



The point is that you don't need both fields. Django already provides a 
reverse relationship whenever you define a foreign key or manytomany, and 
it's this automatic attribute which is clashing. Remove the `album` FK from 
the Song model (after all, if there's a manytomany from Song to Album, that 
implies a song can be on mutliple albums, so there's no point in defining 
the *one* album that a song is on, which is what the FK implies).

Now you can still get from Song to Album via `song.album_set.all().`
--
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/-/_ZI4AS9ovzkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.