All,
I have an abstract base class for which I'm wishing to write some in-
line doctests. I have read ticket http://code.djangoproject.com/ticket/8108
which addresses it, but I'm hoping to find a work-around.
In the snip below, I want to test the Base.__unicode__() method
without writing a docte
class MyModel (models.Model):
name = models.CharField(...)
class MyProxy (MyModel):
class Meta:
proxy = True
ordering = ["name"]
class MyAdmin (admin.ModelAdmin):
pass
admin.site.register(MyProxy, MyAdmin)
The above example does not seem to honor the ordering field within the
adm
All,
When creating a pluggable app, I've run across the need to use the
django.views.generic.create_update.delete_object view. Below is a
snippet of my URL patterns.
from django.conf.urls.defaults import *
from django.core.urlresolvers import reverse
urlpatterns = patterns("",
url(r"list/",
All,
I have the following setup:
--models.py --
from django.db import models
from django.contrib.auth.models import User as DjangoUser
class Business (models.Model):
...
class Group (models.Model):
business = models.ForeignKey(Business)
...
class User (DjangoUser):
group = models.Fore
Looking into this a little deeper, it appears that from
django.contrib.auth.admin.UserAdmin uses
django.contrib.auth.models.User in the meta class. I've attempted to
point this to my app's proxy model by inheriting here as well:
-- forms.py --
from django.contrib.auth.forms import UserCreationFor
Solved by the Manager adding django.contrib.auth.models.UserManager to
the inherited User model.
from django.db import models
from django.contrib.auth.models import User as DjangoUser, UserManager
as DjangoUserManager
class User (DjangoUser):
objects = DjangoUserManager()
The admin site now
All,
I'm attempting to consolidate many orm queries into one. My models:
class Key (models.Model):
name = models.CharField()
class Value (models.Model):
data = models.FloatField()
timestamp = models.DateTimeField()
key = models.ForeignKey(Key)
Given a list of Key names, I am able to ann
Ideally any proposed solution could also substitute the search for the
newest timestamp via Max() to be the largest Value.data float with
similar logic.
Franco
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email t
For reference, it looks like D.Rosman has already wrote about the same
topic at http://blog.roseman.org.uk/.
Franco
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscri
While I haven't worked with formsets, this line doesn't look correct:
formset = ClientFormSet(request.POST, request.FILES,
queryset=Client.objects.get(pk=client_id))
mainly due to a parameter named queryset being passed a model object,
instead of a queryset of model objects. It would seem that yo
All,
Currently I'm working with the following 2 models:
class A (models.Model):
...
class B (A):
somefield = ...
I have a generic views with querysets defined as:
url(r"A/view/(?P\d+)/$",
"django.views.generic.list_detail.object_detail", dict(queryset =
A.objects.all(), template_name =
mis-clicked, continuing:
@register.filter
def A_get_B(instance):
if isinstance(instance, B):
return instance.b
try:
return instance.b
except B.DoesNotExist:
return None
and lastly, the template:
{% with a|A_get_B as b %}
{% if b %}
.. work with b
{% endif
12 matches
Mail list logo