0
votes
0answers
9 views

Copying manytomany field value without hitting DB

I have a proxy model. Now I would like to cast from a given instance of its parent model to an instance of the proxy. I have this code in my manager: def from_parent_user(self, user): instance ...
0
votes
1answer
27 views

Multiple Django Model Queries Changing Independently in One View

I have three models being called separately -- one in my first column, the second in my second column, and the third in my third column. The first is the categories and will stay the same. The second ...
0
votes
1answer
27 views

Incorporate third-party module into Django models

I'm creating a product ID conversion app. I have two models representing the two ID styles: class Id1(models.Model): number = models.CharField(max_length=10) converted = ...
2
votes
2answers
77 views

Django : how to display actual objects in admin

I have a model defination as follows: class Artist(models.Model): """Model class to record Artist""" artist_name = models.CharField(max_length=200) artist_id = ...
0
votes
0answers
20 views

Django model method - create_or_update

Similar to get_or_create, I would like to be able to update_or_create in Django. Until now, I have using an approaching similar to how @Daniel Roseman does it here. However, I'd like to do this more ...
0
votes
0answers
39 views

Django - Multiple Databases

So I'm somewhat new to the whole Django databases and maybe I just don't fully understand the Django routers talked about here: ...
0
votes
0answers
8 views

How to set required translations using django-transmeta?

If you use django-transmeta in a translatable field marked as unique (e.g. name), then you'll have problems with the translations in the following case: As they aren't required, when the user creates ...
1
vote
0answers
26 views

Django with MySQL: DatabaseError (1406, “Data too long for column 'name' at row 1”)

I have a Django webapp, currently been testing with SQLite but now want to deploy and use MySQL, and I'm getting this error. I am getting this error right when using python manage.py syncdb: You ...
0
votes
1answer
29 views

When to use ManyToOne and ManyToMany relationships

The below is a database of colleges, and its ratings. The below is how I thought Each Class (Batch, ex: Batch of 2009) belongs to a Department Each Department (ex: department of pharmacy) belongs to ...
0
votes
1answer
26 views

Django: ManyToMany with ability to order AND to add/remove relationships?

I am building a web application that allows users to have a photo library, filled with photo objects, which they can put into photo albums. They can do the following: Add a photo to an album Remove ...
0
votes
0answers
15 views

Use formset instead of ModelChoiceField in Django 1.5

Right now I have a model class Model1(models.Model): foreign_key1 = models.ForeignKey(Model2) foreign_key2 = models.ForeignKey(Model2) Can I, instead of the ModelChoiceField, create a form ...
2
votes
1answer
43 views

Django: Getting image urls as list

I would like to get image url as list. it is possible to get image url using imageFieldObject.url. Can the same be retrieved using like values_list("imageFieldObject__url") or something? class ...
0
votes
1answer
37 views

Django views, logic, and skinny controllers

So, I have a Django view, which is based on django.views.generic.View, which accepts only POST requests. It takes basic calls in an application/x-www-form-urlencoded format, parses them, and then ...
0
votes
0answers
11 views

Formsets in Django 1.5

I've been looking at formsets in Django 1.5. I've used inlineformset_factory to create an object in Model 1 and some objects in Model 2 which are associated with Model 1. What if I need to create an ...
-2
votes
0answers
19 views

python Django Graph with live streaming data [closed]

I am trying to write a webpage using python Django framework. Here is the details.. Data is coming from an application and it is simultaneously added to a database, My object is to display a live ...
0
votes
0answers
30 views

Django - mongodb invalid literal for int() with base 10

I am trying to host a django-mongodb application in appfog. I'm using django-nonrel, mongo_engine and djangotoolbox. Also the application works fine in a virtualenv in my local machine. But in appfog ...
0
votes
3answers
25 views

Django models: requiring user to input either field, but not both or neither?

Say I have an Image model class Image(... # store file info image = ImageField(... # store link info url = URLField(... # storing either image or url is okay # storing both is ...
0
votes
1answer
18 views

Django Foreign key query

I have the following modle class PatientContact(models.Model): uid = models.CharField(max_length=10) name = models.CharField(max_length=100) phone = PhoneNumberField() class ...
0
votes
0answers
21 views

django user memberships bulk_create

To understand my question these are the models I'm working with: class UserManagedGroup(Group): leader = models.ForeignKey(User, verbose_name=_('group leader'), related_name='leaded_groups') ...
0
votes
1answer
27 views

How to use Django DateTimeField's default

I'm trying to use datetime.datetime.now as the default for my pub_date column, but keep getting an error. DatabaseError: (1054, "Unknown column 'archive_app.pub_date' in 'field list'") I'm just ...
3
votes
0answers
24 views

In which order multiple abstract models are processed in Django [duplicate]

So I have this structure where I have multiple abstract Django models and all my models inherit one or more of these abstract models, for instance class BaseProblem(Base, Slugged, Ownable, Tagged) ...
0
votes
1answer
24 views

Export user data with django in django-admin to CSV

I need to export to csv users of my database, so I have this more or less clear (https://docs.djangoproject.com/en/dev/howto/outputting-csv/), but what I need is to select which fields are exported ...
0
votes
1answer
35 views

Error: object.__new__() takes no parameters

I'm getting the following message, this use to work before. I have removed the .delay function below just to generate the message as this is a task but normally it looks like ...
0
votes
1answer
26 views

User Generated Categories in Django [closed]

I am looking to set up a Django project where a user can create categories and subcategories and so on as many times as they'd like and then categorize whatever items they have or want to add into ...
1
vote
1answer
28 views

How to get foreign key object of a queryset?

I have three models Project, Member, User class Project members = ManyToManyField(User, through="Member") class User #...user model... class Member project = ForeignKey(Project) ...
0
votes
2answers
39 views

Django DoesNotExist

I am having issues on trying to figure "DoesNotExist Errors", I have tried to find the right way for manage the no answer results, however I continue having issues on "DoesNotExist" or "Object hast ...
1
vote
2answers
44 views

How to work with Database over SOAP in Django?

Currently I have a Django project, let's call it Backend. There is a folder api and there I have this resource declared using Django-Tastypie: from django.contrib.auth.models import User from ...
0
votes
1answer
19 views

Dynamic ModelMultipleChoiceField

I have a data table that contain different job genres and their ids. I wnat all the genres to show as a mMltipleChoiceField in broswer , so i tried ...
0
votes
1answer
30 views

Create new or select object in a ForeignKey in Django 1.5

I have two models, model A and model B. In model B I have two ForeignKey fields which refers to the model A. It works, but it requires the model A to have records before I can choose values in model ...
0
votes
1answer
34 views

Delete a child object in Django database

Costumer and Worker models. Costumer inherited from User, and Worker inherited from Costumer, when I do worker.delete(), it will delete all the related object in all three tables, how can I do, ...
0
votes
0answers
57 views

Django model save called twice

I have a django model like this : class UserProfile(models.Model): username = models.CharField(max_length=16) password = models.CharField(max_length=256) email = ...
0
votes
2answers
52 views

Django: Access and Update fields of a Form Class inside __init__ or save functions

I have a MyModelForm form class for MyModel model class, and I want to generate a random value for a certain field. The way I see it is either inside init or save functions, I tried using ...
2
votes
1answer
58 views

Django: Risks in handling data directly from request.POST[“item”]

Sometimes I have a form that is a bit complicated in logic, and needs validation beyond just type checking or regex, so I end up handling data directly from request.POST['item'], like: ...
0
votes
2answers
66 views

What is the django equivalent of this SQL query?

I am very new to django and I am tryin to accomplish some repetitive tasks. I was wondering what would be the django equivalent of the following tasks. I want to select all values that fall within a ...
-1
votes
2answers
38 views

NameError In Django View

I have a model called Finhall and fields under it. But in my view I want to get the value of state field the user clicked on in order to filter other places in that same state. After trying this ...
0
votes
1answer
61 views

Django filter with weird regex

Going through some legacy code, I've stumbled upon this regex in a model filter: "[[:<:]](%s)[[:>:]]" % value I get that the inner square braces are matching literal square braces, but I ...
0
votes
1answer
22 views

Is it possible to use dynamic attributes with Q objects in Django 1.5.1?

I'm using django-transmeta for translated fields and I need to perfom some searches using these translated fields. Suppose we have a Model with a translatable field called translated_field. In the ...
3
votes
1answer
155 views

Django Save Image on different model fields

I have a model called Picture . When an image is uploaded into this model , it will automatically be re-size before saving. My main goal is to re-size the uploaded image into 2 separate images . So I ...
2
votes
1answer
42 views

Is it possible to order a Django Model using the active language?

I'm working on Django 1.5.1 and I'm wondering the following question: Is it possible to define ordering in a model on a translatable field, using django-transmeta and using the active language the ...
0
votes
0answers
52 views

How to insert POST data into Django model using rest-frameWork

I am trying to POST data to my Django app using Django rest-frameWork... My view is : @csrf_view_exempt class subscriptionsList(APIView): def post(self, request, format=None): key = ...
2
votes
2answers
41 views

ImageField in Django with Image from disk

I'm writing an gallery application on Django and i have some question. My goal is to show images from a path in the computer where my app is running. For example all images I want to show are locate ...
0
votes
1answer
22 views

Syndication feeds using Django

How to import details from other websites using Syndication Feeds using Django. Am new to Django python. In my blog i need to use feeds concept. Please give some examples for that.
2
votes
1answer
29 views

Django Tutorial pub_date__year filter works and pub_date__second filter doesn't

I'm working my way through the Django tutorial, and I have a model as follows. class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date ...
0
votes
0answers
21 views

Django select widget not from __str__

How could I somehow override or add more to the labels in django select widget on foreign key field? I need to add some additional info which will not be in this foreign model str function. For ...
0
votes
1answer
39 views

create model from form in django

Is there a way to create a model from a form in django(1.5) ? Like when creating forms from models. My form is class QuoteForm(forms.Form): country = forms.ChoiceField(choices=COUNTRIES, ...
0
votes
0answers
56 views

Django CSV import in order

Right I have my first real problem using Django, as I'm a newbie I just cannot figure this out. I'm using Django-adaptors (although I'm open to other suggestions, but it maps to a model and works ...
0
votes
0answers
20 views

Django pagination duplicatates when ordering by multiple fields

I'm trying to order by two fields using the Django paginator class but I keep getting duplicates on the second page. My model: # models.py class Project(models.Model): title = ...
0
votes
0answers
29 views

Django model polymorphism, using proxy inheritance

This might sound like a duplicate, but I don't think it is. I need to do something a bit similar to what the asker did there : django model polymorphism with proxy inheritance My parent needs to ...
0
votes
0answers
32 views

How to use .extra with .annotate

I am trying to get a field in a queryset which depends on the result of the annotations. I tried using extra on an annotated queryset, which doesn't seem to work. Lets say my models looks like this: ...
0
votes
2answers
21 views

Django models relationship tests

I am new to django testing and have some issues using them to test relationship between models. Here is an extract of my models: class Member(models.Model): user = ...

1 2 3 4 5 39
15 30 50 per page