For the record I figured it out but it had nothing to do with the lambda:
in my template I have a something like:
{{ my_project_lookup_class.classname.get_verbose_name }}
lookup_class.classname will the return the django model class, and the
template engine apparently checks if the class is ca
Probably not it, but try:
...(RestaurantType, default = lambda: (RestaurantType.objects.all()[0]))
And note that your alternate will fail if RestaurantType object with id==1
is ever deleted.
On Tue, Nov 26, 2013 at 7:31 AM, Philippe Raoult
wrote:
>
> I ran into a strange issue today when try
I ran into a strange issue today when trying to use a lambda function for
the default value of a ForeignKey.
my original code was this, and I expected it would look for RestaurantType
instances whenever I would try to create a Restaurant:
type_of_restaurant = models.ForeignKey(RestaurantType, d
3 matches
Mail list logo