Calculating the /jsi18n/ link

2008-12-17 Thread Seemant Kulleen
Dear All,

My admin site seems to be misbehaving.  The datepicker and calendar widgets
on the admin site don't show up.  With the help of firebug, etc, I saw that
the problem was that 'gettext' is not defined.  Looking in the page source,
I see this:


> 
> http://media.kulleen.org/admin/js/core.js";>
> http://media.kulleen.org/admin/js/admin/RelatedObjectLookups.js";>
> http://media.kulleen.org/admin/js/urlify.js";>
>
> http://media.kulleen.org/admin/js/calendar.js";>
> http://media.kulleen.org/admin/js/admin/DateTimeShortcuts.js";>


This is from: https://kulleen.org/admin/blog/entry/add/

As you can see, the commented out script line should actually calculate out
to https://kulleen.org/admin/jsi18n/

And sure enough, going to that address shows some javascript (with gettext
defined in it), but going to plain old https://kulleen.org/jsi18n/  does
not.

So the question is this: how is that stuff in the comments getting
miscalculated, and how can I correct that calculation?  I've got django with
apache2 and mod_wsgi.

Thanks!

Seemant

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



ForeignKey field with null = True and blank = True

2006-10-04 Thread Seemant Kulleen
Hi All,

Now I'm at ForeignKey funkiness.  So I have the Services model which
has a ForeignKey field to the Sermon model.  The funny thing is that
if I choose a sermon object when I first create a new service object,
all is well.  If, on the other hand, I don't choose one, then it turns
out that I can never choose one.  That is to say, I can choose one,
and hit save and when I come back in it's unchosen.  Happens every
single time.  I've attached the services/models.py and
sermons/models.py if that helps.

Thanks!

Seemant


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---
from django.db import models
from django.contrib.auth.models import User
from people.models import Person, Role
from sermons.models import Sermon
import constants

class Service( models.Model ):
	day  = models.CharField  (maxlength = 200)
	date = models.DateField ('date')
	time = models.TimeField ('time')
	slug = models.SlugField (prepopulate_from = ('time',), blank = True)

	priest = models.ForeignKey (
			Person,
			related_name = 'priest',
			limit_choices_to = { 'role__name': 'Priest' },
	)

	celebrant = models.ForeignKey (
			Person,
			related_name = 'celebrant',
			limit_choices_to = { 'role__name': 'Priest' },
	)

	sermon = models.ForeignKey (
			Sermon,
			null = True,
			blank = True,
	)

	crucifer = models.ManyToManyField (
			Person,
			related_name = 'crucifer',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Acolyte' },
	)

	left_torch = models.ManyToManyField (
			Person,
			related_name = 'left_torch',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Acolyte' },
	)
	right_torch = models.ManyToManyField (
			Person,
			related_name = 'right_torch',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Acolyte' },
	)
	banner_bearer = models.ManyToManyField (
			Person,
			related_name = 'banner_bearer',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Acolyte' },
	)

	LEM = models.ManyToManyField (
			Person,
			related_name = 'LEM',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'LEM' },
	)

	lector = models.ManyToManyField (
			Person,
			related_name = 'lector',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Lector' },
	)

	usher = models.ManyToManyField (
			Person,
			related_name = 'usher',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Usher' },
	)

	greeter = models.ManyToManyField (
			Person,
			related_name = 'greeter',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Greeter' },
	)

	childrens_chapel = models.ManyToManyField (
			Person,
			related_name = 'childrens_chapel',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Childrens Chapel' },
			blank = True, null = True,
	)

	altar_flowers = models.ManyToManyField (
			Person,
			related_name = 'altar_flowers',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Flower Guild' },
	)

	flower_delivery = models.ManyToManyField (
			Person,
			related_name = 'flower_delivery',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Flower Deliverer' },
	)

	altar_guild = models.ManyToManyField (
			Person,
			related_name = 'altar_guild',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Altar Guild' },
	)

	food_delivery = models.ManyToManyField (
			Person,
			related_name = 'food_delivery',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Food Deliverer' },
			blank = True, null = True,
	)

	summer_punch = models.ManyToManyField (
			Person,
			related_name = 'summer_punch',
			filter_interface = models.HORIZONTAL,
			limit_choices_to = { 'role__name': 'Punch Server' },
			blank = True, null = True,
	)

	def __str__( self ):
		return self.date.__str__() + self.time.__str__()

	def save( self ):
		if self.slug == '':
			self.slug = '%s%s' % (self.time.hour, self.time.minute)
			super(Service, self).save()
	
	def get_absolute_url( self ):
		return "/services/%s/%s/" % (self.date.strftime("%Y/%b/%d").lower(), self.slug)


	class Meta:
		get_latest_by = 'date'
		ordering = ['-date']

	class Admin:
		list_display = ('date', 'time', 'priest',)
		search_fields = ('priest', 'celebrant')
		list_filter = ('date',)

		fields = (
('Date Information', {'fields': ('day', 'date', 'time', 'slug')}),
('Officials', {'fields': ('priest', 'celebrant',)}),
('Sermon', {'fields': ('sermon',)}),
('Acolytes', {'fields': 

ManyToManyFields are not syncdb'able

2006-10-02 Thread Seemant Kulleen
Dear All,

I've attached two files: people/models.py and services/models.py.  I
have two many-to-many relationships defined: one is between people and
roles (each person can fill many roles, and each role can be filled by
many people); and one is between each activity in the service (banner
bearer, crucifer, and so on) and people (each activity can be performed
by many people in a specific role and each person can perform many
activities).  Chris Long and tomaw helped me come up with appropriate
"limit_choices_to" constructs in the services/models.py to restrict each
activity to specific roles -- so that in the admin etc, only specific
people are presented as choices for each activity.  Now, when I run
python manage.py syncdb (with sqlite3 and postgresql both), I get the
following error:


Error: Couldn't install apps, because there were errors in one or more
models:
3crowns.services: no such table: people_role


However, if I remove the limit_choices_to and then syncdb, it succeeds.
If I then re-add the limit_choices_to constructs and run:  python
manage.py reset services I get no errors, and in fact, the admin view
shows exactly what I expect/hope it will show.

This is either a bug with me or a bug with django, and when I think
about it, I reckon it's a bug with me, so I appeal for your help :)

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---
from django.db import models
from django.contrib.auth.models import User
import constants

class Role( models.Model ):
	name = models.CharField (unique = True, maxlength = 100)

	def __str__( self ):
		return self.name

	class Meta:
		ordering = ('name',)

	class Admin:
		pass


class Person( models.Model ):
	first_name = models.CharField (maxlength = 100)
	last_name  = models.CharField (maxlength = 100)
	user = models.ForeignKey (
			User,
			verbose_name="Associated admin user",
			null = True,
			blank = True
	)
	role = models.ManyToManyField (
			Role,
			filter_interface = models.HORIZONTAL
	)

	
	def __str__( self ):
		return '%s %s' % (self.first_name, self.last_name)

	class Meta:
		ordering = ('last_name',)
		verbose_name_plural = 'people'

	class Admin:
		pass
from django.db import models
from django.contrib.auth.models import User
from people.models import Person, Role
from sermons.models import Sermon
import constants

class Service( models.Model ):
	day  = models.CharField  (maxlength = 200)
	date = models.DateField ('date')
	time = models.TimeField ('time')
	slug = models.SlugField (prepopulate_from = ('time',), blank = True)

	priest = models.ForeignKey (
			Person,
			related_name = 'priest',
	)

	celebrant = models.ForeignKey (
			Person,
			related_name = 'celebrant'
	)

	crucifer = models.ForeignKey (
			Person,
			related_name = 'crucifer',
	)

	left_torch = models.ForeignKey (
			Person,
			related_name = 'left_torch',
	)
	right_torch = models.ForeignKey (
			Person,
			related_name = 'right_torch',
	)
	banner_bearer = models.ForeignKey (
			Person,
			related_name = 'banner_bearer',
	)

	LEM = models.ManyToManyField (
			Person,
			related_name = 'LEM',
			filter_interface = models.HORIZONTAL,
	)

	lector = models.ManyToManyField (
			Person,
			related_name = 'lector',
			filter_interface = models.HORIZONTAL,
	)

	usher = models.ManyToManyField (
			Person,
			related_name = 'usher',
			filter_interface = models.HORIZONTAL,
	)

	greeter = models.ManyToManyField (
			Person,
			related_name = 'greeter',
			filter_interface = models.HORIZONTAL,
	)

	childrens_chapel = models.ManyToManyField (
			Person,
			related_name = 'childrens_chapel',
			filter_interface = models.HORIZONTAL,
	)

	altar_flowers = models.ManyToManyField (
			Person,
			related_name = 'altar_flowers',
			filter_interface = models.HORIZONTAL,
	)

	flower_delivery = models.ManyToManyField (
			Person,
			related_name = 'flower_delivery',
			filter_interface = models.HORIZONTAL,
	)

	altar_guild = models.ManyToManyField (
			Person,
			related_name = 'altar_guild',
			filter_interface = models.HORIZONTAL,
	)

	food_delivery = models.ManyToManyField (
			Person,
			related_name = 'food_delivery',
			filter_interface = models.HORIZONTAL,
	)

	summer_punch = models.ManyToManyField (
			Person,
			related_name = 'summer_punch',
			filter_interface = models.HORIZONTAL,
	)

	sermon = models.ForeignKey (
			Sermon,
			blank = True,
			null = True
	)

	def __str__( self ):
		return self.date.__str__() + self.time.__str__()

	def save( self ):
		if self.slug == '':
			self.slug = '%s-%s%s' % (self.date.__str__(), self.time.hour, self.time.minute)
			super(Service, self).save()
	

	class Meta:
		get_latest_by =