1
vote
1answer
30 views

How can I import many values to one foreign key value

I have an import script that imports from a csv file, but one value (customer) can repeat itself. So for example name will always be different, but customer (john) can have 5 entries. I need to import ...
0
votes
2answers
37 views

Django IntegerField returns ExpressionNode

I got a model containing two counters : class MyObject(models.Model): ... student_c = models.PositiveIntegerField(default=0, blank=True, null=True) company_c = ...
0
votes
1answer
20 views

Django prefetch_related From Model With Multiple ManyToMany Relationships

Say I have a few models in Django: class Foo(models.Model): bars = models.ManyToManyField(Bar) bazs = models.ManyToManyField(Baz) class Bar(models.Model): quxs = models.ManyToManyField(Qux) I can ...
0
votes
1answer
45 views

How can I force django to use the lowest model instance?

Suppose I have my models set up like this: class B(Model): ... def __str__(self): return "B" class C(B): ... def __str__(self): return ...
0
votes
1answer
26 views

Loop through objects and change their values

I have my model set up so that when a liquor is added to a store, it gives it it's own in-store ID based on the count. I've called this the SPI. The addition function works fine, it properly assigns ...
0
votes
0answers
24 views

“Followers” w/ Django 1.5 [on hold]

I've seen a few people suggest that ManyToManyFields w/ a pluggable user model means that implementing basic followers is as simple as putting a ManyToManyField in the user model or another app and ...
0
votes
1answer
34 views

Can I relate one-to-one to a key-value model?

Consider this Django schema: class Foo(models.Model): # ... class FooOption(models.Model): foo = models.ForeignKey(foo, related_name='options') key = models.CharField(max_length=64) ...
0
votes
1answer
32 views

Does setattr() method creates a temporary object?

This is in reference to a great answer Can I use JSON data to add new objects in Django? However I am particularly intrigued by how this component works: member, _ = ...
0
votes
2answers
37 views

What is _ in: “member, _ = Member.objects.get_or_create(name = self.name)” [duplicate]

I am trying to understand the code in relation to this great answer: Can I use JSON data to add new objects in Django? Specifically I would like to know what the _ means in the method below. def ...
0
votes
1answer
33 views

Is it possible to pass the dynamic id with django input form

html generated by django form: <tr> <td>Email:</td><td><input id="id_email" type="text" name="email" maxlength="100" /></td> </tr> <tr> ...
0
votes
1answer
27 views

When variables not allowed to be null are actually created with no data on Django

I was recently adding large amounts of data from a JSON file to my Django "member" model. For this purpose I had to make most of my variables able to take in null or blank in order to handle cases ...
0
votes
1answer
45 views

how to update data using popup in django

views.py def setting(request): followup_form = FollowupSettingsForm() if request.method == 'POST': followup_form = FollowupSettingsForm(request.POST) if ...
0
votes
1answer
11 views

members_data.dob may not be NULL in Django

Using Django 1.4 in my app I defined a model called Member and another called Data.Every member has basic like ID and it is related to a Data object that contains additional variables describing the ...
0
votes
1answer
17 views

How to find the difference between two columns in Django model and print result for each row in view

class Daily(models.Model): rpt_date = models.DateField('Report Date', primary_key=True) total_d_sors = models.IntegerField() loaded_d_sors = models.IntegerField() #diff_d_count ...
-1
votes
1answer
37 views

python manage.py syncdb errors [on hold]

I guys when run the command python manage.py syncdb i have the following errors: Traceback (most recent call last): File "manage.py", line 11, in <module> execute_manager(settings) ...
-3
votes
0answers
47 views

Django, pin me a song on a playlist babe [closed]

first of all, sorry for my poor English, I was asked to create for a web audio application a "button", like the pinterest one, which allow a pre-registered user to pin music in a playlist. So that ...
2
votes
1answer
75 views

Return results from multiple models with Django REST Framework

I have three models — articles, authors and tweets. I'm ultimately needing to use Django REST Framework to construct a feed that aggregates all the objects using the Article and Tweet models into one ...
1
vote
3answers
37 views

Creating django users using two different ways

I tried creating Users (django.contrib.auth.models.User) in django via two different ways: Using User.objects.create(username="<username_here>", password="<password_here>", ...
2
votes
2answers
27 views

Django order_by last week days

models.py class short_url(models.Model): """ This is a short_url class """ blocked = models.BooleanField(default=False) # To check whether URL is ...
0
votes
2answers
25 views

is it possible to add a button with variable in templatetags

templatetags.py from django import template from django.utils.safestring import mark_safe register = template.Library() @register.filter("as_span") def as_span(ZergitForm): ZergitForm_as_span ...
0
votes
1answer
28 views

Could not import setting.views.types. View does not exist in module setting.views

widgets.py from django.utils.safestring import mark_safe from django.forms.widgets import Widget, Select from django import forms from django.conf import settings class ...
0
votes
1answer
41 views

Filter multi-table inheritance in django

I want to make a dynamic filter for multi-table inheritance. class Product(models.Model): name ... class Product1(Product): color ... class Product2(Product): length ... tags = ...
1
vote
0answers
23 views

Handle multiple language filename for FileField in Django models

Here a simple django model: class File(models.Model): info = models.CharField(max_length=150,null=True,blank=True) slug = models.SlugField(max_length=50, blank=True) file = ...
0
votes
0answers
27 views

update data from a row into popup

I am doing the edit functionality,on clicking the button the data from that particular id gets loaded in the popup,the problem is update is not happening.If i submit the form it is creating new row of ...
0
votes
0answers
21 views

Creating a Proxy Model Manager in Django 1.4

I am working with a proxy model and trying to write a custom Model Manager for it. I don't want it to replace the default Model Manager, so I've made the Proxy Model mixin the ExtraManager model: ...
0
votes
1answer
43 views

How do I render this Django form?

I have a form where a user checks whether or not they own items from a particular brand. When the box is checked, a textbox appears beneath the checked item to take a product review. My models.py ...
1
vote
2answers
35 views

How to properly use the “choices” field option in Django

I'm reading the tutorial here: https://docs.djangoproject.com/en/1.5/ref/models/fields/#choices and i'm trying to create a box where the user can select the month he was born in. What I tried was ...
0
votes
0answers
53 views

replace <li> to <div> class not working

forms.py class TypeSelectionForm(forms.Form): checkbox_field = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple(), label="", required=False) def __init__(self, type_id, *args, ...
1
vote
1answer
57 views

how to produce <span> instead of <li> tag

forms.py class ZergitForm(forms.Form): zerg_selection = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple(),required=False) views.py def feeds(request): if request.method == ...
0
votes
2answers
33 views

Specialized django query

As you can guess from the title, I'm not exactly sure how to describe what I want. Please take a look at the following classes: from django.db import models from django.contrib.auth.models import ...
0
votes
0answers
30 views

Create portfolio backed skill-set in django ORM

I have a specialized User class that inherits from django.contrib.auth.models.User. Now, this User class will have tags associated with it, for example: Blogger, French Cuisine Cook, Python ...
0
votes
1answer
13 views

Grouping OneToOne Fields together in the Admin interface

I have 4 OneToOne relations to a model, and in the admin area I would like to group them so they can be edited in pairs(2 groups of 2). Is there a way to do this similar to using fields?
0
votes
0answers
51 views

form instance not loaded in popup

view.py def edit_follower(request): followup_edit = FollowupForm() if request.method == 'POST': if 'edit_followup' in request.POST: follower_id = ...
1
vote
1answer
26 views

How to distinctly bulk update all objects of a django model without iterating over them in python?

Basically can we achieve the same result without doing this: from my_app import models for prd,count in x.iteritems(): ...
1
vote
2answers
56 views

Simple inner join with django

I'm beginning with Django and I've got what I think is a simple question. How can I obtain the result of the next query with QuerySet? select * from poll p, choice c where p.id = c.poll_id ...
3
votes
4answers
335 views

how to add <div> tag instead of <li>

forms.py class TypeSelectionForm(forms.Form): checkbox_field = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple(), label="", required=False) def __init__(self, type_id, *args, ...
3
votes
1answer
40 views

Why are my django model fields not working?

I don't think that it is recognizing the existence of my fields. Here's my models.py: from django.db.models import * from django.contrib import admin from django.forms import * class Stock(Model): ...
0
votes
0answers
36 views

silently truncating django model char field

I'm trying to do a mass import of data into an existing database. Sometimes the string fields in this other database contain strings that are larger than the field I'm importing them into. I'm OK with ...
1
vote
1answer
24 views

XLRD unsupported format found

Using version 0.9.2 of XLRD and python 2.7 on WINDOWS... Im creating a temporary file and then reading the file using XLRD data = self.excel_file path = default_storage.save('temp/temp.xls', ...
-1
votes
1answer
37 views

Django Filter by Foreign Key

class UserTomonotomo(models.Model): userid= models.BigIntegerField(null=False, unique=True, db_index=True) email= models.CharField(max_length=100L, null=True) ###################### ...
0
votes
0answers
100 views

__init__() got an unexpected keyword argument 'instance'

Im getting the above error when I run this code. This is happening when I return return modelformset_factory in def get_form_class(self): But its ok when I use return modelform_factory. What could be ...
0
votes
1answer
17 views

Can't get django-testapp to work or create a superuser with django-norel

I'm new to django-nonrel and I'm trying to get the djang0-testapp to run. I can't even create a superuser. I am following the instructions from here I downloaded the django-testapp from here I ...
1
vote
2answers
34 views

I can't insert row into database - django

I have a problem with inserting row into sqlite using ModelForm. I realy don;t see what am I doing wrong. Any suggestions? Thanks! This is my view: def row(request): if request.method == 'POST': ...
0
votes
1answer
34 views

(2, 'No such file or directory') when trying to open a csv file on Django

I cannot for the life in me figure out why I keep getting this error. So I have a django module that is running the following code c = open('file.csv', 'rb') reader = csv.reader(c) rows = [] rownum = ...
0
votes
0answers
32 views

Connecting Social Auth to MongoEngine models gives errors

After doing necessary modifications in my settings.py file as explained in MongoEngine and Social Auth documentations, I added this code finally: AUTH_USER_MODEL = 'mongo_auth.MongoUser' ...
0
votes
1answer
31 views

Django model phone field

The contents of models.py for books app. from django.db import models from django.core.exceptions import ValidationError from django.core.validators import RegexValidator class ...
0
votes
1answer
60 views

Update the relation to point at settings.AUTH_USER_MODEL

I'm getting this error. I'm trying to configure tschellenbach/Django-facebook package. I was getting "user or profile didnt have attribute facebook_id" error. So I tried to configure it using the code ...
2
votes
1answer
37 views

Django queryset : cannot F() and count at the same time

I have a hard time understanding if this is a bug (most likely) in Django 1.5.2 and older, or me doing it wrong. I wrote a queryset which uses the F() expression on a DateTimeField. This works well. ...
1
vote
0answers
22 views

Where do I create custom profile models for django-userena?

I have a django app called my_app that uses django-userena; I am trying to create and use my own profile model by following the django-userena installation documentation. In my_app/models.py I've ...
0
votes
2answers
44 views

Django Import Class From models.py

Using a folder structure like this: library/ -django.wsgi -manage.py -static/ --all my static files -library/ --__init__.py --models.py --settings.py --urls.py --views.py ...

15 30 50 per page