0
votes
1answer
26 views

django submit image fom url file name stored wrong

I'm trying to submit image from url based on the answers of this question but as a result I have image file stored successfully , but with filename .jpg instead of image-name.jpg code import ...
1
vote
1answer
24 views

Django ModelForm make field from other fields

I have these models class Color(models.Model): code = models.CharField(max_length=7, unique=True) name = models.CharField(max_length=100) class Tshirt(models.Model): name = ...
0
votes
1answer
23 views

I want Django to use calls to a RESTful API instead of a db

I want to create a Django app that consumes a RESTful web service. What I imagine I want is for Django to expose resources through its ORM, but retrieve those resources from a web service. There are ...
0
votes
1answer
37 views

Can Django user model inheritance and abstract class be used in combination?

Im just getting in to both Python and Django, so pardon my ignorance. In building out my models I've decided to go with user extension rather than replacement. Just seems simpler and I'm still new. ...
0
votes
1answer
14 views

In Django custom user manager, difference between create_user and _create_user()?

I'm trying to work through the tutorials for a Django custom user manager. Most of them override create_user() and create_super_user() like the documentation says to do, but this tutorial leaves those ...
1
vote
2answers
35 views

Override Class Attribute, with a generic way to refer to class

I have a Django abstract Model. class Company(models.Model): DEFAULT_EMPLOYEES = None employees = models.PositiveIntegerField(null=True, blank=True, ...
0
votes
0answers
49 views

How to delete record in from table(Django framework)?

q1 and q3 are parent questions. q2 is sub question of q1. q4 is sub question of q2. q3 dont have any children. Snapshot 1 : Snapshot 2: Logic : snapshot 1 : is showing the structure on ...
0
votes
1answer
23 views

Create_user() in custom manager or save() method in Django custom user model for processing field before creating new record?

I have a Django custom user model with a save() method that tests for self.pk is None and does some extra processing to a field before creating a new user record. Is this the right place to put that ...
2
votes
2answers
49 views

__init__() got an unexpected keyword argument 'user'

i am using Django to create a user and an object when the user is created. But there is an error __init__() got an unexpected keyword argument 'user' when calling the register() function in view.py. ...
1
vote
0answers
50 views

Django custom User shoots an import issue at runtime when syncing db

I have a custom User model defined in app.models. It is also correctly defined in the AUTH_USER_MODEL setting as app.User. When I run the site, everything works perfectly. However, when I run ...
0
votes
1answer
29 views

Django - get values from a self-defined object

i am using Django to create an OneToOneField object for user with code below: class ControlInformation(models.Model): user = models.OneToOneField(User) TURN_ON_OFF = ( ('ON', 'On'), ...
0
votes
0answers
31 views

Stuck with custom Permission

I have models, and now i add custom permission: class Menu(models.Model): name = models.CharField(max_length=30) podmenua = models.BooleanField() poradi = ...
0
votes
2answers
40 views

Django: retrieve all unseen posts for a user

I have a Django data model like this: class Post(django.db.models.Model): text = django.db.models.CharField() class Seen(django.db.models.Model): post = django.db.models.ForeignKey(Post) ...
0
votes
1answer
28 views

Django add new Model and Form in a new app

i am using Django and trying to add a new model which can only be accessed after user login. Firstly, i built a model class of UserProfile in an app, using def create_user_profile(sender, instance, ...
0
votes
1answer
20 views

Multiple Django Databases - Map Model to Database in Same Application

I have searched all over for a solution for this but have been unable to find anything. I have one Django project, one application, two models and two database. I would like one model to speak and ...
1
vote
4answers
30 views

Django parameters read in wrong order

I have the following model: class Work(models.Model): title = models.CharField(max_length=30) amount = models.PositiveIntegerField() percent = ...
1
vote
1answer
26 views

Django: I have extended group model, how to make queries to get field value?

I have extended the group model as the following: class MyGroup(ProfileGroup): mobile = models.CharField(max_length = 15) email = models.CharField(max_length = 15) c_annotates = ...
1
vote
1answer
27 views

Setup Django Blog Comments

If I wanted to setup comments for a blog in Django, and I wanted people to be able to reply to comments (like a normal blog), meaning each comment would have to know if it's a comment on another ...
2
votes
3answers
37 views

how to display the data from the database in a template

i have following model: class comment(models.Model): userid=models.CharField(max_length=140) apparelid=models.IntegerField(blank=True) desc=models.TextField(blank=True) def ...
0
votes
1answer
22 views

How to check whether an event has guest list or not before saving?

I have two tables "Event" and "GuestList". While saving an event we can mention whether it is a public or private event. If it is a private event we must have a guestlist if it is not it is optional ...
0
votes
1answer
46 views

File upload not working after changing models format

I have a model class similar to following - class Document(models.Model): docfile = models.FileField(upload_to='documents/%Y/%M/%D') Everything is working fine and files are uploaded ...
0
votes
1answer
31 views

django python document object listing even deleted files

Why this django-python snippet showing deleted files also in uploaded document list ?? views.py def lists(request): # Handle file upload if request.method == 'POST': form = ...
0
votes
1answer
56 views

Object created twice in database on save()

Here is my class model: class Request(models.Model): client = models.ForeignKey(Client, related_name='requests') driver = models.ForeignKey(Driver, related_name='requests', null=True, ...
0
votes
3answers
55 views

Django - pass a value from form to model

i am using Django form module to get value and pass it to user profile. The only problem is that the home_type is a "forms.ChoiceField" but there is no "clean_data" type for the forms.ChoiceField, so ...
0
votes
1answer
38 views

How to make a modelform editable foreign key field in a django template?

I have a company model: class Company(models.Model): companyId = models.IntegerField(unique=True, blank = True, null = True ) address = models.ForeignKey(Address, blank = True, null = True ) ...
1
vote
1answer
36 views

Django 1.6 for_concrete_model explained

I'm looking at the Django doc 1.6 on GenericForeignKeys. I'm confused about this new statement means. Could someone explain? for_concrete_model New in Django 1.6. If False, the field ...
3
votes
1answer
47 views

Django: Returning models.CharField() value from getter method is empty

Here is my model class. In this I've added a new getter method url() to return a url string for an author profile. But when I'm calling this method in html template file this shows empty. See here is ...
0
votes
1answer
36 views

Hybrid sql/nosql data store in Django for document-based fields?

I am creating an application that needs to allow users to create custom fields, which I think would be best stored in a document-based (basically a serialized dictionary) model field. I am concerned ...
0
votes
1answer
29 views

django db query, getting error

here is my model : class company_profile(models.Model): user=models.ForeignKey(User, unique=True) company=models.CharField(max_length=200) def __unicode__(self): ...
1
vote
1answer
34 views

Customize the styles of Django ClearableFileInput widget

I have use ImageField in my django model to have the image upload facility. ImageField uses the ClearableFileInput widget but it does not provide well formatted html markup that i can customize using ...
1
vote
1answer
27 views

Dynamically access Django models fields python

I've a model Level class Level: level1_id = models.IntegerField() level2_id = models.IntegerField() level3_id = models.IntegerField() level4_id = models.IntegerField() level5_id = ...
4
votes
1answer
178 views

Django many-to-many generic relationship

I think I need to create a 'many-to-many generic relationship'. I have two types of Participants: class MemberParticipant(AbstractParticipant): class Meta: app_label = 'participants' ...
0
votes
2answers
29 views

Django: how to create manytomany field across app

I was trying to extend the auth.models Group for some extra fields. Here is what I have done in myapp.models.py: class ProfileGroupBase(type): def __new__(cls, name, bases, attrs): module ...
1
vote
0answers
22 views

Django Tabular Formset

This is on Django 1.5. I have what appears to be a simple problem, but which turned out to be really complicated in practice. So I'm working on a job application site, and I have 2 models: ...
1
vote
1answer
36 views

how to get the third properties from many to many relationship tables?

I have models in python django framework like: class PropertyTaxItem(models.Model): property = models.ForeignKey(Property) class Property(models.Model): citizens = ...
0
votes
1answer
33 views

How can I change the strings as variables in python django?

I want to change the strings as variables. I have 7 models in Django. class Level1: level1_id = models.IntegerField() level1_name = models.CharField() class Level2: level2_id = ...
1
vote
1answer
27 views

Django - Thumbnails for images in Admin interface

I am trying to implement images in Django for the first time. I'm using Django 1.5, Python 2.7 on Fedora 19. I am following this tutorial as an example. Here's what the models.py looks like. from ...
1
vote
1answer
39 views

Dajngo-import-export - import of advanced fields?

For a Django model I'm using django-import-export package. If need to export more then just available model fields, like properties or custom fields, new can be added with import_export.fields.Field ...
0
votes
1answer
106 views

MultiValueDictKeyError in Django admin

UPDATE model: class PicturesManager(models.Manager): def create_pictures(self, flat, img): pictures = self.create(car=car, image=img) return pictures def get_file_path(instance, ...
0
votes
1answer
17 views

How to make django admin site to not recognize a foreign key'ed model (on different app) to be a model of current app?

I have three models - two of them are in one app, and the third one is on the another. The structure is like this: taapp.models: class Teachers(model.Model): fullname = ...
0
votes
0answers
27 views

django relatedname filter not working

I am trying to do this: search['relatedname__fieldname__gte'] = 3 objs = Model.objects.filter(**search) but it seems not to be working, i am getting only objs with =3 and not >3 am i missing any ...
0
votes
0answers
36 views

Django admin hierarchical organized listbox

I have a django model with a foreign key like this: class Exercise(models.Model): name = models.ForeignKey(Name) Names can be several (more than 100), so in the admin I have very long listbox, ...
0
votes
1answer
23 views

How do I query on two incoming models using the Django ORM?

I've got the following models: class DataStream(models.Model): category = models.CharField(max_length=255) description = models.TextField() class DataStreamSubCategory(models.Model): ...
0
votes
1answer
63 views

Django model operating on a queryset

I'm new to Django and somewhat to Python as well. I'm trying to find the idiomatic way to loop over a queryset and set a variable on each model. Basically my model depends on a value from an api, ...
0
votes
1answer
33 views

How can I link a registered user from django-registration to the model of my app?

I plugged the django-registration app into my project and it works great. New Users can register and log in. In my app, however, I want to supply a whole profile to the user and use the information ...
0
votes
1answer
31 views

how to iterate over a m2m field with __contains

I'm trying to search within 3 manytomany fields within a model to see if a user is within either of those fields. I'm using Q for an or on all 3 fields but I can't seem to find a way to actually see ...
0
votes
0answers
43 views

Display the list of all the users in admin

I'm trying to display the list of all the existing users and their corresponding questions. I can't seem to figure out this code isn't working. I should be able to add a new question to the existing ...
1
vote
1answer
30 views

NoneType object is not callable when adding saved FK

I'm getting the error message 'NoneType' object is not callable when trying to save Campaign. In Django does it mean once I have saved my object SingleVoucherReward() I don't have access to it and ...
-1
votes
0answers
61 views

'dict' object has no attribute 'META'

I'm trying to get data from sqlite but it's showing a error msg :- Exception Value: 'dict' object has no attribute 'META' Exception Location: ...
0
votes
0answers
44 views

django database error when linking one to one to the user model

im creating an app where i have different users that have some attributes that the user model doesnt have, to do that im extending the user authentication model from django using a oneToone ...

15 30 50 per page