Data dodania Pytanie
2017-03-08 08:03 pytest won't convert date field to datetime.date object in Django »
I have this simple query written in Django and I want to run my tests with pytest. results = (self.base_query .order_by('service_d...
(1) odpowiedzi
2017-03-07 23:03 django admin enable sorting for calculated fields »
I have the following two fields in my db table and model (Model Name: Order): id, branch_id, product_id, cost, quantity, status, ordered_at And I h...
(1) odpowiedzi
2017-03-07 14:03 Django CSRF token is missing from signup form »
I have another problem caused by the major upgrades I've done to a Django app (from 1.7 to 1.10 and Django Rest Framework to 3.5.4). I managed to fix ...
(1) odpowiedzi
2017-03-07 10:03 How to raise an exception in pytest? »
I have written a code in views.py def fun(): try: --Do some operation-- except OSError: --Do something else-- And I hav...
(1) odpowiedzi
2017-03-07 10:03 why is Django MultipleObjectsReturned Error hogging memory? »
I am using Django 1.9.10: I have a model called Details has a unique_id column which is indexed: try: detail = Detail.objects.get(unique_id=U...
(3) odpowiedzi
2017-03-06 23:03 Should I test view's attributes in unit tests? »
I am wondering what is a proper way to unit test a Django view, for example this one: class UserListView(LoginRequiredMixin, ListView): model = ...
(1) odpowiedzi
2017-03-06 10:03 Django manager first() vs Model.objects.all()[:1] »
I would like to know if first() is the same as limiting querysets. Is Model.objects.first() the same as Model.objects.all()[:1] in speed? You've to ...
(2) odpowiedzi
2017-03-06 08:03 Transform multiple values from url to json in Django »
I have this URL: http://example.com?variable=1&variable=2&a=text I want to transform those values to JSON. I have tried: data = json.dum...
(1) odpowiedzi
2017-03-05 22:03 How to configure ViewFlow, many functionality »
How to configure ViewFlow on Django project? I am new to Django community and I'm trying to install and test the functionality that have ViewFlow in ...
(1) odpowiedzi
2017-03-05 14:03 Django let User Update TextField value on Site via forms? »
I hope someone can give me a little help on how to do the following with Django (excuse me if I don't explain everything correct, still new to Django ...
(2) odpowiedzi
2017-03-05 12:03 Get foreign key unicode value in the template rather than its id »
My model consists of ForeignKey and I am using generics.DetailView to render object detail in the django view. MyModel class MyModel(models.Model): ...
(1) odpowiedzi
2017-03-04 19:03 custom django command - help string not visible in shell completion »
Following is a custom command I have written in following file myapp/management/commands/create_myadmin.py from django.core.management.base import Ba...
(1) odpowiedzi
2017-03-04 17:03 the using of AuthenticationForm in django return no errors »
I'm trying to use the AuthenticationForm model to authenticate my users. Here is my view : from django.contrib.auth.forms import AuthenticationForm ...
(1) odpowiedzi
2017-03-04 03:03 Unexpected behavior using Bootstrap-Table and Javascript in Django (inline editable) »
I'm using bootstrap-table with inline editable plugin to create a bootstrap table for a list of laptop. My goal was to apply changes to my csv file af...
(0) odpowiedzi
2017-03-03 16:03 Filtering using viewsets in django rest framework »
Please consider these three models: class Movie(models.Model): name = models.CharField(max_length=254, unique=True) language = models.CharFie...
(4) odpowiedzi
2017-03-03 10:03 (Django)How to map two urls to one view? »
This is my class from models.py: class Person(models.Model): name = models.CharField(max_length=64) persnr = models.AutoField(primary_key=Tru...
(4) odpowiedzi
2017-03-03 08:03 Assert a function is not executed in Python unittest »
I am using Django for my web development framework. And now I am writing unittest. How can I assert that a function is not executed in my test code? ...
(2) odpowiedzi
2017-03-02 17:03 Django breaking long lookup names on queries »
Let's assume there is a line of code to perform a query using the Django ORM that contains a very long 'lookup name': QuerySet.filter(myfk__child__on...
(3) odpowiedzi
2017-03-02 16:03 How to run tests in django using database with data? »
I want to test my views using data from postgres localhost database (with already loaded data). I'm using tox with pytest and pytest-django. My quest...
(1) odpowiedzi
2017-03-02 06:03 django template call javascript function on loop »
I am looping in a javascript template like: {% for movie in movies %} {{movie.name}} {% endfor %} Is there anyway like I can call a javascript ...
(1) odpowiedzi
2017-03-01 17:03 Django Rest Framework: Register multiple serializers in ViewSet »
I'm trying to create a custom API (not using models), but its not showing the request definition in the schema (in consequence, not showing it in swag...
(1) odpowiedzi
2017-03-01 11:03 JSON string parsing error in Python »
I am sending a request to an API and it returns this JSON response '{"Reply":{"Header":{"Method":"mGSSCBetHistory","ErrorCode": "0","MerchantID":"BET...
(2) odpowiedzi
2017-03-01 09:03 Django filter on values of child objects »
I have the following (simplified) data model: class Article(Model): uuid = models.CharField(primary_key=True, max_length=128) class Attribute(Mo...
(3) odpowiedzi
2017-02-28 18:02 Django generic relations modelling »
I'm trying to model something in Django and it doesn't seem quite right. A Book and a Movie can have one or more Persons involved in it, each of whom ...
(1) odpowiedzi
2017-02-28 16:02 How to update extended User Model using Django Forms? »
I am new to Django and need a help. I want to allow users to update their account data using form, but struggle with associating Django User model wi...
(1) odpowiedzi
2017-02-28 08:02 Display the object related set objects in the admin »
I have three models for Movie, NowShowing and UpComingMovie. NowShowing and UpComingMovie has foreignkey relationship with the Movie. class Movie(mod...
(1) odpowiedzi
2017-02-27 20:02 Trying to make a cart using django but in views I am passing product id rather than slug because I am adding product to cart directly from homepage »
Cart App views.py from django.shortcuts import render, HttpResponseRedirect from django.core.urlresolvers import reverse # Create your views here. ...
(2) odpowiedzi
2017-02-27 12:02 Django: method in models vs method in views »
I ask myself this question, what the difference and the more performant between a method in models.py and views.py ? Example 1: models.py: class Co...
(1) odpowiedzi
2017-02-27 10:02 Saving to database with one query »
I have standard django User model and I have an extended model Member. The Member model is connected to Subscription model. class Type(models.Model):...
(2) odpowiedzi
2017-02-26 22:02 CreateViews and assigning values to two OneToOneFields »
I am trying to set the value of two OneToOne fields on save in a CreateView. Here are the two models (each living in separate apps). CompanyProfile ...
(1) odpowiedzi
2017-02-26 01:02 Django counting one to many relationship »
So i have two tables, Post and Category Code: model.py class Category(models.Model): category = models.CharField(max_length=100) def __s...
(1) odpowiedzi
2017-02-26 00:02 How to serve static files to AWS when deploying Django app (`python manage.py collectstatic` didn't work)? »
Yesterday, I created this post: DjangoRestFramework browsable api looks different locally vs when deployed on server? Basically, when I did python ma...
(1) odpowiedzi
2017-02-25 23:02 How to install packages to docker's python? »
How to install packages to docker's python? For example, I need lmxl. Inside django application in docker I run pip install lxml and terminal respon...
(2) odpowiedzi
2017-02-25 15:02 What is the purpose of running a django application in a virtualenv inside a docker container? »
What is the purpose of virtualenv inside a docker django application? Python and other dependencies are already installed, but at the same time it's n...
(2) odpowiedzi
2017-02-25 01:02 Django CreateView show error not working »
How can I prevent the Repetition of renting a car for the same period the car was already rented or reserved for ex : 01/01/2017 to 01/03/2017 if i t...
(1) odpowiedzi