Tagged Questions

1
vote
0answers
12 views

How to perform a datamigration when moving from one-to-one to one-to-many

I'm using south to manage migrations and I've hit a corner. Basically I have the following setup: App1: class A(models.Model): # bunch of attributes App2: class B(models.Models): instance_a = ...
1
vote
0answers
15 views

Defining a set of relation fields for a generic view in Django

Well, i'm using a generic view to display my selected fields defining my method fields, it works, but what i'm trying to do it's as follows, in one of my custom fields i want to retrieve name value of ...
0
votes
0answers
22 views

Django deploying admin on Static ip

i have configured my vmware network setting to static ip to reach it from my main machine to check out before publishing. when i entered my static ip from main machine as a.a.a.a/demo/admin , i have ...
0
votes
2answers
32 views

Getting all objects referenced in a foreign key field

I have models similar to class Person(Model): name = CharField(max_length=100) class Movie(Model): ... director = ForeignKey(Person) How would I get the set of all Person objects which ...
0
votes
1answer
25 views

How to call a method in views.py automatically after updating/modifying the table in Django?

I am building a web based application, in which i need to send the notification to registered user by E-mail after updating or modifying some value in tables. I have a model.py: class ...
2
votes
3answers
31 views

Django: how to annotate queryset with count of filtered ForeignKey field?

Django novice question :) I have the following models - each review is for a product, and each product has a department: class Department(models.Model): code = models.CharField(max_length=16) ...
1
vote
1answer
35 views

Django Rest Framework using the url to load specified models

Is it possible to use generic url settings to implement the django rest interface for all models in django? So instead of per model configuration: class BlogResource(ModelResource): model = Blog ...
4
votes
1answer
51 views

Django changing app name of Photologue

i have installed photologue - A customizable plug-in photo management application for the Django web framework here into my project without problem... now i want to change app name in admin page ...
2
votes
1answer
35 views

Django ModelForm get next item in list after submit

I'm not really too sure how to title this question, but I'm trying to develop a simple webapp with Django. What I'm trying to do is that the user will manually tag each image, and each tag will have a ...
2
votes
1answer
29 views

Django Models Filtering

I have the following: def foo(self): print "Test" scores = BasicScore.objects.filter(event__id=self.id).order_by('score_date')[0:1] print scores #return s #return ...
0
votes
1answer
27 views

Two ManyToMany fields without backwards relation

I'm trying to have a model with 2 ManyToMany fields without allowing a backwards relation. So here is the model: class Camp(models.Model): #... free_options = models.ManyToManyField('Option', ...
1
vote
1answer
27 views

How to create ModelForm with objects that are owned by a particular user [closed]

Possible Duplicate: How do I filter ForeignKey choices in a Django ModelForm? Say I have some models that look like this: from django.db import models from django.contrib.auth.models ...
0
votes
2answers
30 views

Django DatabaseError when deleting any record from admin?

i have asked a question about manytomanyfield here which i solved but now a new problem is raised as, DatabaseError at /admin/myapp/photo/8/delete/ relation "woek_gallery_photos" does not exist LINE ...
1
vote
1answer
51 views

Django ManyToManyField filter with parameters?

I have such models: class Category(Model): ... type = models.CharField(max_length=255, choices=settings.CATEGORIES) class Product(models.Model): ... categories = ...
2
votes
2answers
40 views

Django ManyToManyField Error when saving in admin?

What is wrong with my code? class Group(ImageModel): title = models.CharField(verbose_name = "Title", max_length=7) photos = models.ManyToManyField('Photo', related_name='+', ...
2
votes
2answers
51 views

Optional year/month/day in Django model date field(s)

I want a Django model to have a date field in which the year, month, and day are all optional. An example value could be as generic as 2008 or as specific as May 10, 2008. Is it possible to define a ...
0
votes
1answer
19 views

Changing a datafield into a database in selenium testcase: django python

There is this field in my database which is package_expiry_date , now I want to change its value from selenium test case itself to use it after a while. like extend the date by 5 days by adding ...
0
votes
1answer
21 views

Adding data in django admin filtering

Hi I have 3 models in my django. Product, Client, and Order. Class Client(models.Model): name = ... .... Class Product(models.Model): name = ... client = models.ForeignKey(Client) ..... Class ...
0
votes
0answers
17 views

In django-taggit, how to get tags for objects that are associated with a specific user?

I have a series of objects that are associated with specific users, like this: from django.db import models from django.contrib.auth.models import User from taggit.managers import TaggableManager ...
1
vote
2answers
32 views

DatabaseError no such table with a ManyToManyField

So this is the situation: I'm adding a new column(presenters) to my Event table. I ran the alter table sql statements, ran python manage.py syncdb. I'm trying to be able to select many profiles and ...
0
votes
1answer
32 views

django autofill manytomany field in admin

Good day, not so long ago, working with Django. Encountered the following problem. There are two models class Product(models.Model): productID = models.AutoField(primary_key=True) ...
0
votes
0answers
51 views

Django configurable Moderation and Flags of multiple models

I have multiple models which should be flaggable and moderable. It's quite similar to the system here on Stackoverflow. There is a related question to this one, and another one, but they do not answer ...
2
votes
1answer
54 views

Django `auth` and `contenttypes` breaks syncdb

When I issue the command: python manage.py syncdb --database=mydb It shows the output as follows... Creating tables ... Creating table auth_permission Creating table auth_group_permissions Creating ...
0
votes
2answers
36 views

what's the most efficient way to get combination infomation of a model and its “primary key side” of another model?

I am dealing with a "extending" model of django's User model.Here is my model's definition: class UserProfile(models.Model): user = models.ForeignKey(User, unique=True, editable=False) ...
0
votes
0answers
41 views

Django Csv Importer integer error

I'm using the latest Django Csv Importer found here: http://django-csv-importer.readthedocs.org/en/latest/index.html Line 2 of the CSV that contains integers does not have any blank lines. They're ...
0
votes
1answer
66 views

Python 2.7.2 Ubuntu + Django 1.4; deepcopy recursion error when “.objects.get(foo=unicodestr)”

i'm getting a strange error on a obviously simple task. I want to querry a sqlite DB with an unicode string and with following model: from django.db import models class Uebersetzung(models.Model): ...
0
votes
1answer
38 views

Python and Django fails to run [python manage.py sql application]

Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "D:\PythonPack\lib\site-packages\django\core\management\__init__.py", ...
0
votes
1answer
86 views

Django ModelForm with dynamic model init kwargs

I have a model with an __init__ method: class Foo(models.Model): name = models.CharField(max_length=50) def __init__(self, *args, **kwargs): self.bar = kwargs.pop('bar', False) ...
1
vote
1answer
45 views

Django query for top models

I have a django model which every instance has an attribute of item_id. I want to query for the top item ids based on which has the most votes. I have tried this with no success. ...
1
vote
1answer
34 views

Nested display in django admin (multipe foreign keys)

Let's say I have 3 models, a company, its divisions, and the divisions' employees. Divisions have a foreign key to companies and employees have a foreign key to divisions. Is there a way to make it ...
1
vote
1answer
29 views

django manytomany object's field returns empty

I have a couple of classes in a model linked with ManyToManyField: class UserProfile(models.Model): contacts = models.ManyToManyField(Contact) class Contact(models.Model): first_name = ...
1
vote
1answer
31 views

Customising model returned in view

Usually in a django view you would do something like queryset = MyModel.objects.something() How do I get more control over the shape of the object returned. Sorry for the heresy, but in ASP.Net MVC ...
1
vote
2answers
55 views

How do I use sorl-thumbnail? (django)

I've been looking at the sorl-thumbnail's documentation, and I still can't figure out how to: 1. upload images to sorl-thumbnail. 2. selectively show images from sorl-thumbnail. (for example, ...
0
votes
0answers
40 views

to link users e.g followers and following using django [closed]

How do I structure my models so as a user can be able to follow or unfollow users using django .please help me with some tips manytomany foreignkey some little confussion here..??
1
vote
5answers
123 views

Order model by field with choices

I'm trying to order models in a Django app using a field that has predefined choices. I can sort alphabetically, but since the choices are the days of the week, that doesn't quite match what I need. ...
1
vote
1answer
40 views

Django model tags

I am working on a django app and need to add a tags field to one of my models. In the admin interface i need it to work like the wordpress tagging.. (comma separated entry, auto create new tags and ...
0
votes
2answers
71 views

accessing foreign key in django queryset

In the example below, I have a model Proof which contains a foreign key to the model Option. I want to list all the options in my template along with their respective proofs. How would I go about ...
1
vote
0answers
59 views

Many-to-one relationships ComboBox filtering

Experts! Having the following models.py class Country(models.Model): name = models.CharField(max_length=50) def __unicode__(self): return self.name class Meta: ...
0
votes
2answers
37 views

Is there any way to read data from the django admin interface request for pre save validation?

I know the following function can be used to do some pre-save processing. But, how can I access the request data, for example a text field value from the request for doing validation? def ...
1
vote
3answers
47 views

How to define django foreign key limit_choices_to constraint which has reference to it's own model?

Here are the models. I need to avoid the reference of Filter objects in the FilterValue model which are being already referenced in the FilterValue model. class Filter(models.Model): name ...
-6
votes
0answers
53 views

don't know how to join django userina and django trending app models [closed]

i want to join django userina and django trending user application's to use the trending user functionality with the user getting registered through usernina and display the online users on a separate ...
1
vote
1answer
48 views

Using a persistent database in Django unittests

I have a large readonly Wordnet PostgreSQL database that I'd like to use from Django unittests. Specifically, I have an app, called "wordnet", that wraps this Wordnet database. Unfortunately, the ...
2
votes
1answer
81 views

Django models and Python properties

I've tried to set up a Django model with a python property, like so: class Post(models.Model): _summary = models.TextField(blank=True) body = models.TextField() @property def ...
1
vote
1answer
33 views

For a 1 to 1 relationship in Django, do the 2 models share ids?

If I have model that has a 1 to 1 relationship with another, do they share primary ids? Thank you.
1
vote
2answers
37 views

Django: Edit ModelForm using AutoField

I'm trying to make a view where the user can edit DB records through a form in a template. I've searched a lot of web pages (and Django docs as well) where they teach how to make these views, but they ...
1
vote
2answers
33 views

Generating tables for INSTALLED_APPS fails

Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "D:\PythonPack\lib\site-packages\django\core\management\__init__.py", ...
0
votes
2answers
49 views

Django filter/exclude giving erroneous result, why?

I have a django query that is giving me an erroneous queryset. From the following individual queries, it should give me 1 - 0 = 1, but instead it gives me 0 results. Why is this so? >>> ...
3
votes
1answer
56 views

Create two objects in save method

I want to overwrite a save method so that two objects are created for each save instead of one. How would I do the following? class Message(models.Model): thread = ...
1
vote
0answers
46 views

Secure Execution of Possibly Insecure Code Within Django?

Currently, I am working on a function within a project that requires me to load code that is stored in an online database. The code should be moderately trusted, but not entirely. We currently use ...
0
votes
2answers
46 views

Appropriate way to override Model __getattr__ in 1.4

What's the appropriate way of overriding the a Model class's getattr in Django 1.4? I have a model structure like: class Main(models.Model): [blah] class Detail(models.Model): main = ...

1 2 3 4 5 29
15 30 50 per page