We've used HighCharts with chartjs. It works; it's not ideal, but we use it
very extensively and it's customisable enough to use in a reasonable way.
However, depending on your requirement, it's probably more advisable get
your django view to return the appropriate json for a d3 front end.
HTH.
Sorry if this isn't for here, but I've somehow got the wrong version of
python running with mod_wsgi --2.7 instead of 3.4, so none of the 3.4
libraries work, like collections or datetime.
Where do I look to change this?
--
You received this message because you are subscribed to the Google Groups
I want to have a model that has a foreignkey to a model from another app.
The app can be one of many.
So far I've come up with a two field solution with:
model_type = ForeignKey(ContentType)
pk_field = PositiveIntegerField()
with an appropriate getter. Is there a better way to do this? It feels
Awesome -- thanks!
On Mon, Sep 19, 2016 at 6:48 PM, Tim Graham wrote:
> Do you know about https://docs.djangoproject.com/en/stable/ref/contrib/
> contenttypes/#generic-relations ?
>
>
> On Monday, September 19, 2016 at 12:30:01 PM UTC-4, Jonty Needham wrote:
>>
>>
t;> /en/stable/ref/contrib/contenttypes/#generic-relations ?
>>
>>
>> On Monday, September 19, 2016 at 12:30:01 PM UTC-4, Jonty Needham wrote:
>>>
>>> I want to have a model that has a foreignkey to a model from another
>>> app. The app can be one of many.
>
I have the following code which is supposed to create a MyConfig object.
However, it doesn't as the app_model is always returned as None.
The idea is to choose from a select few contenttypes and then add a key,
and the resulting config will trigger a bunch of services. However whenever
I save the
Ignore this. Field was in excluded_fields which I thought only stopped the
display of fields, but actually stops the data from that field getting into
the model.
On Wed, Sep 28, 2016 at 4:59 PM, Jonty Needham
wrote:
> I have the following code which is supposed to create a MyConfig obj
So I have one model, which uses a ContentType to point to a collections of
models across separate apps.
I want to be able to "plug in" the functionality linking that model to the
other models in the separate app. So we have the follwing:
class MyModelMixin(models.Model):
""" Mixin to get the
Hi,
In an attempt to fix my earlier query about related names etc, it would
appear that I've (half() fixed my issue.
I now have:
submission = GenericRelation(
MyModel,
related_query_name='%(app_label)s_related_name')
So that's good and gives me the related names. However, wh
Stuck. If anyone has ideas that would be brilliant.
Django 2.2, running on Ubuntu 18.04 in a venv
$ python manage.py runserver
Exception in thread django-main-thread:
Traceback (most recent call last):
File
"/home/jonty/.virtualenvs/tdj_playground/lib/python3.6/site-packages/django/template/ut
Hi,
I need to do a file upload in django where if the file fails appropriate
checks then an error is raised back to the user without 500ing the page.
I've got a form that does what I want, however it returns the error in a
new page, but I want it returned in place. So I need an async call. What's
I have a model of the form:
class Jobs(models.Model):
names = models.ManyToManyField(Workers)
class Workers(modesl.Model):
is_a_problem = True
And I want the set of jobs that are done by workers who are a problem.
Something like
Jobs.objects.filter(names__is_contained_in=Workers
worker problem)
>
>
> On Wed, Dec 23, 2015 at 9:31 AM, Jonty Needham
> wrote:
>
>> I have a model of the form:
>>
>> class Jobs(models.Model):
>> names = models.ManyToManyField(Workers)
>>
>> class Workers(modesl.Model):
>> is_a_pro
So I have an object that contains a foreignkey to another object that will
be deleted, that means that my object should get deleted.
Having read some of the docs on
https://docs.djangoproject.com/en/1.7/ref/models/fields/#django.db.models.ForeignKey.on_delete
(yes I know it's 1.7) I understand tha
The, um, link in my question answers my question.
On Wed, Dec 23, 2015 at 4:57 PM, Jonty Needham
wrote:
> So I have an object that contains a foreignkey to another object that will
> be deleted, that means that my object should get deleted.
>
> Having read some of the doc
I have a ModelAdmin class where I am using callables to define accessors to
a foreign key's field.
I.e.
class MyAdmin(admin.ModelAdmin):
def field_name(self, obj):
return obj.fk.field_name
readonly_fields=(field_name, other_field)
Ultimately I need to translate the labels, but
Thanks so much. Sorted competely!
On Mon, Jan 11, 2016 at 5:44 PM, Erik Cederstrand wrote:
>
> > Den 11. jan. 2016 kl. 23.21 skrev Jonty Needham >:
> >
> > I have a ModelAdmin class where I am using callables to define accessors
> to a foreign key's field.
&g
Currently I want to allow certain users access to a certain administrator
page to allow or deny access for other users for a part of the tool.
I have overridden has_permission to grant access, however it says that "You
don't have permission to edit anything".
I've since tried overriding has_add/
I've found a need to do this and I'm struggling. Some info seems to
indicate that django doesn't support this. How is it meant to be done?
Basically to be clear, I need to filter one queryset on a reverse
foriegnkey relation to another set of objects defined by a particualr
filter.
model1(Models.
Is there a way to do it? I've seen the method with extra, but that doesn't
seem to work for me. Does the 1.8 ORM support this out of the box?
Thanks in advance.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and
I'm running mod-wsgi and I've got the following config in my Virtualhost in
my apache site config:
SetEnv F3_SECRET_KEY Very_secret_keySetEnv DJANGO_SETTINGS_MODULE
config.settings.setttings
WSGIScriptAlias / /var/django/path/to/my/app/config/wsgi.py
WSGIDaemonProcess wsgiprocess
python-path=/usr/
I'm not sure what this error means or how to resolve it. I'm guessing it's
because in my model I'm trying to assign a field to the value of the
average of all the many2many's from another field. But I can do this at the
command line happily, yet when I put it on a submethod I can't do it, so I
don'
Sent too soon!
def calculate_score(self):
return
x.m2m_set.filter(condition).aggregate(avg=Avg('m2m_subfield__score'))['avg']
returns the "Relation fields do not support nested lookups" error
On Fri, Apr 8, 2016 at 11:27 AM, Jonty Needham
wrote:
> I
23 matches
Mail list logo