Re: Best approach to write unit tests involving rest apis.

2015-12-02 Thread learn django
On Wednesday, December 2, 2015 at 10:48:52 PM UTC-8, Xavier Ordoquy wrote: > > Hi, > > > Le 3 déc. 2015 à 00:12, learn django > a écrit : > > > > My app uses rest framework. > > I am writing test cases which involve standard requests like > GET/POST/DELETE/PUT. > >

Re: Best approach to write unit tests involving rest apis.

2015-12-02 Thread Xavier Ordoquy
Hi, > Le 3 déc. 2015 à 00:12, learn django a écrit : > > My app uses rest framework. > I am writing test cases which involve standard requests like > GET/POST/DELETE/PUT. > What is the best approach to write the test cases ? Django REST framework comes with a test

Re: RemoteUserMiddleware stay logged in

2015-12-02 Thread Dan Davis
Thanks, I can probably just install it and use it. If I must stay in 1.8 for some arcane reason, I can read the code at https://github.com/django/django. On Monday, November 30, 2015 at 8:29:00 PM UTC-5, Tim Graham wrote: > > Does the PersistentRemoteUserMiddleware added in Django 1.9 help? >

Re: Tests not passing in suite but pass individually

2015-12-02 Thread learn django
Will try to send minimal project by end of the day. Hopefully I can discover the reason during this exercise. On Wednesday, December 2, 2015 at 3:33:30 PM UTC-8, Tim Graham wrote: > > It looks correct. I'd like a minimal project I could download to reproduce > the issue. In putting that

Re: Tests not passing in suite but pass individually

2015-12-02 Thread Tim Graham
It looks correct. I'd like a minimal project I could download to reproduce the issue. In putting that together, you might discover the reason for the failure. On Wednesday, December 2, 2015 at 6:29:07 PM UTC-5, learn django wrote: > > Below is the test file & logs. > No matter in which order

Re: Tests not passing in suite but pass individually

2015-12-02 Thread learn django
Below is the test file & logs. No matter in which order (using --reverse) I run the suite it fails. The database backend is postgres. Is that an issue ? File:- === import datetime import pdb from rest_framework import status from rest_framework.test import APIClient from django.http import

Best approach to write unit tests involving rest apis.

2015-12-02 Thread learn django
Hi, My app uses rest framework. I am writing test cases which involve standard requests like GET/POST/DELETE/PUT. What is the best approach to write the test cases ? Should I run the web server from unit test in setUp() (by running 'python manage.py runserver') so that http request response

Resolving circular dependencies when squashing migrations

2015-12-02 Thread Nikolas Stevenson-Molnar
I'm attempting to squash migrations on my Django 1.8 project and am running into a mess of circular dependencies. The docs suggest in this case to "break out one of the ForeignKeys in the circular dependency loop into a separate migration, and move the dependency on the other app with it." [1] 

Re: [ANNOUNCE] Django 1.9 released

2015-12-02 Thread Tim Graham
I later discovered that it's actually a bug in setuptools 5.5/5.5.1. I'll update the documentation. On Wednesday, December 2, 2015 at 2:05:52 PM UTC-5, François Schiettecatte wrote: > > I see the error too, no virtualenv or pip here, this is my install > sequence: > > tar zxf

Re: [ANNOUNCE] Django 1.9 released

2015-12-02 Thread François Schiettecatte
I see the error too, no virtualenv or pip here, this is my install sequence: tar zxf Django-1.9.tar.gz cd Django-1.9 python3 ./setup.py build sudo python3 ./setup.py install F. > On Dec 2, 2015, at 5:31 AM, Luke Granger-Brown wrote: > > On Wed, Dec 2, 2015

Re: AttributeError: type object 'Product' has no attribute '_meta'

2015-12-02 Thread Lucas Vieira May
try this: from django.db import models # Create your models here. class Product(models.Model): item_name = models.CharField(max_length=100) item_price = models.IntegerField() item_image = models.ImageField() def __unicode__(self): return self.item_name class Meta: # Do

Re: Tests not passing in suite but pass individually

2015-12-02 Thread 'Tom Evans' via Django users
On Wed, Dec 2, 2015 at 4:20 PM, Siddhi Divekar wrote: > Hi Tim, > > Below is what am trying to achieve. > > class OrcaTestCase(TestCase): > > def test_customer_create_modify_delete(self): > '''Test customer object create, modify and delete operations in >

Re: Tests not passing in suite but pass individually

2015-12-02 Thread Tim Graham
How does the test fail? Please show the entire test file including imports. On Wednesday, December 2, 2015 at 11:20:27 AM UTC-5, learn django wrote: > > Hi Tim, > > Below is what am trying to achieve. > > class OrcaTestCase(TestCase): > > def test_customer_create_modify_delete(self): >

DataError on get_or_create with nullable fields

2015-12-02 Thread mccc
(this is mostly copied/pasted from my comment on an eight-years-old issue here ) I cannot get the get_or_create operation to create non-existing object with nullable field, getting a `DataError: integer out of range` error. The query goes like so:

Re: Tests not passing in suite but pass individually

2015-12-02 Thread Bill Freeman
Did you see some documentation that said that the test framework will clear the database? I'm not sure that it's reasonable to ask a test framework to do that, given the number of possible databases and interface layers, though it is conceivable that django's variation on test could take care of

Re: Tests not passing in suite but pass individually

2015-12-02 Thread Siddhi Divekar
Hi Ke1g, That is the last option but wanted to understand why database was not cleaned after first test. On Wednesday, December 2, 2015 at 7:56:26 AM UTC-8, ke1g wrote: > > Make test b clean up after itself, by deleting the test object. > > On Wed, Dec 2, 2015 at 9:28 AM, Tim Graham

Re: Tests not passing in suite but pass individually

2015-12-02 Thread Siddhi Divekar
Hi Tim, Below is what am trying to achieve. class OrcaTestCase(TestCase): def test_customer_create_modify_delete(self): '''Test customer object create, modify and delete operations in DB.''' # Create. CustomerDb.objects.create(c_name='Pnc', c_role='ADFS-Admin',

Issue: get user type in custom submit_line.html template

2015-12-02 Thread Alessandro Peretti
Hi folk, I added a submit button in submit_line.html. I want to show it just for staff users and not for superusers. So I inserted {% if request.user.is_superuser %} but it doesn't work. It seems that the django variable user is outside this scope. How can I fix it? Thanks in advance. --

Problem to retrieve user type in custom submit_line.html template

2015-12-02 Thread Alessandro Peretti
Hello folk, I have a problem with my submit_line.html. I added a button through " input type="submit" value="{% trans 'Send Email' %}" name="_send_email" />" to send an email. In my admin.py of my app I override the save_model method to send an email and save the new istance created inside the

Re: Tests not passing in suite but pass individually

2015-12-02 Thread Bill Freeman
Make test b clean up after itself, by deleting the test object. On Wed, Dec 2, 2015 at 9:28 AM, Tim Graham wrote: > It will be easier to help if you can provide a sample project that > reproduces the error. > > On Wednesday, December 2, 2015 at 3:01:31 AM UTC-5, Siddhi

Re: Tests not passing in suite but pass individually

2015-12-02 Thread Tim Graham
It will be easier to help if you can provide a sample project that reproduces the error. On Wednesday, December 2, 2015 at 3:01:31 AM UTC-5, Siddhi Divekar wrote: > > Hi, > > Am seeing that test case in suite are failing but passing when ran > individually. > I have gone through most of the

Re: Transitioning existing login portal to Django

2015-12-02 Thread 'Tom Evans' via Django users
On Tue, Dec 1, 2015 at 10:15 PM, Evan Palmer wrote: > Hello, > > Does anyone have experience with transitioning an existing database > including user login data to Django? > > I am about to begin work on a startup's hand-written web portal that > consists of about 2000 lines

Django doesn't remove the "old" file after change

2015-12-02 Thread Fellipe Henrique
I have one ImageField in my Model, but when I change the image, django doesn't remove the old file. How can I make these happen? when change the file, the old one need to be deleted. I use ImageKit, so I try to override *storage * method in ImageFile field, but django start to save in my disk,

Re: [ANNOUNCE] Django 1.9 released

2015-12-02 Thread Luke Granger-Brown
On Wed, Dec 2, 2015 at 10:20 AM, Mike wrote: > pip install django >> Downloading/unpacking django >> Downloading Django-1.9-py2.py3-none-any.whl (6.6MB): 6.6MB downloaded >> Installing collected packages: django >> Compiling >>

Re: [ANNOUNCE] Django 1.9 released

2015-12-02 Thread Dimitris R
You need to upgrade pip. See https://docs.djangoproject.com/en/1.9/releases/1.9/#syntaxerror-when-installing-django-with-pip-1-5-6 On Wednesday, 2 December 2015 12:20:49 UTC+2, Mike wrote: > > pip install django >> Downloading/unpacking django >> Downloading Django-1.9-py2.py3-none-any.whl

Re: Recursion error after upgrading from 1.8 to 1.9

2015-12-02 Thread Gergely Polonkai
New info: I have removed everything after django.contrib.staticfiles, but the problem still persists. 2015-12-02 11:57 GMT+01:00 Gergely Polonkai : > I have upgraded Django from 1.8.5 to 1.9. Running my tests fails with this: > > RuntimeError: maximum recursion depth

Re: Transitioning existing login portal to Django

2015-12-02 Thread 'Alan Hicks' via Django users
Hi, I treat them as a straightforward migration (not Django's btw). Create the models and functionality to replicate existing then write sql if necessary to convert to the new schema. Depending on the complexity, the migration should not try to change much until it's in a (Django) form you

Recursion error after upgrading from 1.8 to 1.9

2015-12-02 Thread Gergely Polonkai
I have upgraded Django from 1.8.5 to 1.9. Running my tests fails with this: RuntimeError: maximum recursion depth exceeded while calling a Python object My INSTALLED_APPS: INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes',

Re: [ANNOUNCE] Django 1.9 released

2015-12-02 Thread Mike
> > pip install django > Downloading/unpacking django > Downloading Django-1.9-py2.py3-none-any.whl (6.6MB): 6.6MB downloaded > Installing collected packages: django > Compiling > /Users/mike/sieve2/SIEVEENV/build/django/django/conf/app_template/apps.py > ... > File >

Re: How to save a table in a cell in django models.

2015-12-02 Thread Timothy W. Cook
On Wed, Dec 2, 2015 at 2:27 AM, Billu wrote: > What I want to do is generate a HTML table (alongwith other data viz. > images, text) when somebody opens a page. > > So how would I *save *a table, i.e, what would be the keyword for it eg. > CharField, IntegerField. > >

How to save a table in a cell in django models.

2015-12-02 Thread Billu
What I want to do is generate a HTML table (alongwith other data viz. images, text) when somebody opens a page. So how would I *save *a table, i.e, what would be the keyword for it eg. CharField, IntegerField. I've googled and people have written that you need to save XML data in the

Re: Custmo field numpyarray - why does this even work?

2015-12-02 Thread Joakim Hove
Sorry; how do you get the nice code formatting - I thought it was through the use of ... blocks? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Tests not passing in suite but pass individually

2015-12-02 Thread Siddhi Divekar
Hi, Am seeing that test case in suite are failing but passing when ran individually. I have gone through most of the thread on the internet but did not find any solution. Below is the snip of what am trying to do. class A(TestCase): def test_a(): create an obj in db retrive obj list

Re: Turn off migrations completely in Django 1.7

2015-12-02 Thread john . rg . orr
+1 for disabling migrations completely - for several reasons. 1. Right now, I'm trying to run tests against a production database with runserver, in *read-only* mode - but it fails because it can't create the django_migrations table. (I'm in the process of upgrading from Django 1.4 to 1.8, so

Custmo field numpyarray - why does this even work?

2015-12-02 Thread Joakim Hove
Hello; I want to create a custom model field for storing a numpy array. It has currently been so simple that I fear I am overrlooking something and getting a very false positive? class NumpyArrayField(BinaryField): dtype = numpy.float32 @classmethod def load_numpy_array(cls ,