Development Server Ignores IP-address Parameter

2015-07-15 Thread tdthomas93
For some reason, my Django Development Server ignores the IP:Port parameter 
when I start it. No matter what I enter for that parameter, it always uses 
127.0.0.1:8000.  I think (but am not sure) this started happening when I 
upgraded from Django-1.7 to Django-1.8.2.

I am running on Slackware Linux, I have not noticed this problem until
recently.  It definitely worked correctly several months ago.

At the bottom of this message, I show how I launch the server,
and the response it gives in my console. No matter what IP:Port
I request, I always get 127.0.0.1:8000.

How can I fix this problem?

Thanks.

I start the development server with the following command:

  % python  manage.py runserver  192.168.0.102:8001

The following reply appears on the console:

  /usr/local/lib/python3.3/importlib/_bootstrap.py:313: 
RemovedInDjango19Warning: django.utils.importlib will be removed in Django 
1.9.
  return f(*args, **kwds)

  Performing system checks...

  System check identified no issues (0 silenced).
  July 15, 2015 - 17:45:10
  Django version 1.8.2, using settings 'app3.settings'
  Starting development server at http://127.0.0.1:8000/
  Quit the server with CONTROL-C.


-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a695a746-618a-46a2-a216-180577e829ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Two Things: (1)-ModelChoiceField with a searchbox and (2)-Related Dropboxes

2015-07-15 Thread François Schiettecatte
Another option would be JQuery Autocomplete:

https://github.com/devbridge/jQuery-Autocomplete

I have used both, JQuery Autocomplete is simpler to get going but Select2 is 
more flexible.

François

> On Jul 15, 2015, at 7:27 PM, Dan Tagg  wrote:
> 
> Select2 can do this https://select2.github.io. Other alternatives are 
> available too.
> 
> Dan
> 
> On 13 Jul 2015 4:27 pm, "Miguel Pereira Legal"  wrote:
> I have this two questions:
> 
> I am trying to write a small stock management system, and I am finding 
> problems in the Form.
> See, when an item goes out I have a dropbox (ChoiceField) to choose the item 
> that is going out, but this dropbox gets too long when you have so many 
> elements in the data base to choose from.
> 
> There is a way to implement a ChoiceField with a integrated search box to 
> make this search and selection more flexible?
> 
> If anyone have another idea, I will listen.
> 
> In the other hand, about the related dropboxes.
> What about if I have a Form where I need to chose a Manufacturer and THEN a 
> Model (i.e Samsung and then S6).
> 
> I need that after the selection of "Samsung" the next dropbox filter the 
> options for that manufacturer. I need that functionality because if the user 
> can choose freely the Manufacturer and then de model, it could be wrong (i.e. 
> the user could choose Samsung and then 6S, and 6S is not a cellphone model of 
> Samsung).
> 
> Thanks for your patience.
> 
> -- 
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/742c2210-5cce-42cb-9997-c9258fd602db%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAPZHCY4FFYe8XMwwrFLjnHnVhCNMJJGpnq6mimfm2x9Lujpp3g%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/13C57846-57C5-4827-B23E-86F8F3687604%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Two Things: (1)-ModelChoiceField with a searchbox and (2)-Related Dropboxes

2015-07-15 Thread Dan Tagg
Select2 can do this https://select2.github.io. Other alternatives are
available too.

Dan
On 13 Jul 2015 4:27 pm, "Miguel Pereira Legal" 
wrote:

> I have this two questions:
>
> I am trying to write a small stock management system, and I am finding
> problems in the Form.
> See, when an item goes out I have a dropbox (ChoiceField) to choose the
> item that is going out, but this dropbox gets too long when you have so
> many elements in the data base to choose from.
>
> There is a way to implement a ChoiceField with a integrated search box to
> make this search and selection more flexible?
>
> If anyone have another idea, I will listen.
>
> In the other hand, about the related dropboxes.
> What about if I have a Form where I need to chose a Manufacturer and THEN
> a Model (i.e Samsung and then S6).
>
> I need that after the selection of "Samsung" the next dropbox filter the
> options for that manufacturer. I need that functionality because if the
> user can choose freely the Manufacturer and then de model, it could be
> wrong (i.e. the user could choose Samsung and then 6S, and 6S is not a
> cellphone model of Samsung).
>
> Thanks for your patience.
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/742c2210-5cce-42cb-9997-c9258fd602db%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPZHCY4FFYe8XMwwrFLjnHnVhCNMJJGpnq6mimfm2x9Lujpp3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Two Things: (1)-ModelChoiceField with a searchbox and (2)-Related Dropboxes

2015-07-15 Thread felix

El 13/07/15 10:09, Miguel Pereira Legal escribió:

I have this two questions:

I am trying to write a small stock management system, and I am finding 
problems in the Form.
See, when an item goes out I have a dropbox (ChoiceField) to choose 
the item that is going out, but this dropbox gets too long when you 
have so many elements in the data base to choose from.


There is a way to implement a ChoiceField with a integrated search box 
to make this search and selection more flexible?


If anyone have another idea, I will listen.

In the other hand, about the related dropboxes.
What about if I have a Form where I need to chose a Manufacturer and 
THEN a Model (i.e Samsung and then S6).


I need that after the selection of "Samsung" the next dropbox filter 
the options for that manufacturer. I need that functionality because 
if the user can choose freely the Manufacturer and then de model, it 
could be wrong (i.e. the user could choose Samsung and then 6S, and 6S 
is not a cellphone model of Samsung).
I'm a newbie and I guess that you need to use AJAX to accomplish these 
tasks.

A javascript library, or framework like AngularJS could be useful here.

Cheers,
Felix.

--
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55A6D11A.9070204%40epepm.cupet.cu.
For more options, visit https://groups.google.com/d/optout.


Re: Playing with API- DjangoProject Part 1

2015-07-15 Thread James Schneider
Best advice is to read the overview page, and then follow the tutorial
link. After you've completed the tutorial, you should have a good
understanding of where to go and what you can do with Django:

https://docs.djangoproject.com/en/1.8/intro/overview/

-James
On Jul 15, 2015 9:51 AM, "Auj Nizkgi"  wrote:

> Thank you for your help James. I have deleted the the folder the contained
> the framework and will be starting from scratch.
>
> I completed 'learn python the hard way' along with a few more beginner
> level courses for python. I'm sure you read or get this question daily, but
> what would you recommend is a good place to start for Django. I feel I need
> some more explanations and basic level knowledge than what's on the
> djangoproject. I want to create my own landing page that has sign in and
> log in features for a set of questions to be asked. Ultimately, I want to
> get familiar with Django. I started coding about 3 months ago and I have
> absorbed a lot considering my background prior experience.
>
> Any advice would be helpful. Thanks for all the support!
>
> On Tue, Jul 14, 2015 at 7:06 PM, James Schneider 
> wrote:
>
>> > When I run the shell, I keep getting errors. Also, I have created the
>> > question three times now so when I type q.id , I get a return value of
>> 3.
>> > How can I delete them. 
>>
>> Easy enough.
>>
>> q.delete()
>>
>> You may have to perform a query to gather up the other questions that
>> you've already created and perform delete operations on each of those.
>>
>>
>> >  Also when I ask the question text (q.question_text) I
>> > get "" instead of the "Whats up".
>>
>>
>> That is odd. I'd be interested to see the series of commands that you
>> are running to get this result. Can you paste everything that you are
>> typing into the shell and all of the responses? It's almost as though
>> you've done something like p.question_text = p before printing out p.
>>
>>
>> >
>> > Any help would be greatly appreciated.
>> >
>> > The error when I run the shell:
>> >
>> > q$ python manage.py shell
>> >
>> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
>> > RuntimeWarning: Model 'polls.question' was already registered. Reloading
>> > models is not advised as it can lead to inconsistencies, most notably
>> with
>> > related models.
>> >   new_class._meta.apps.register_model(new_class._meta.app_label,
>> new_class)
>> >
>> >
>> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
>> > RuntimeWarning: Model 'polls.choice' was already registered. Reloading
>> > models is not advised as it can lead to inconsistencies, most notably
>> with
>> > related models.
>> >   new_class._meta.apps.register_model(new_class._meta.app_label,
>> new_class)
>> >
>> > Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
>> > [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>> > Type "help", "copyright", "credits" or "license" for more information.
>> > (InteractiveConsole)
>> 
>> >
>>
>> While I've never seen this error before, it would seem that something
>> is amiss in your models.py and/or possibly your admin.py. I've seen a
>> few google posts saying that this error was received because they were
>> importing models in both models.py and in admin.py.
>>
>> Please post both files, along with your settings.py, which may shed
>> more light on the issue.
>>
>> -James
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/rkHCIznabR0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXKpkuF3nY%2BbLanHUEN1T9AEr%2B_0ZtbCk911U6krqqfsQ%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSjUQXOubVhT3yjW_6jvHF63MxXdQzojT7rfo52JwO-tDH21A%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


Re: Playing with API- DjangoProject Part 1

2015-07-15 Thread Harish Challa
Hi all please let me know if you know how to fix following

[7/15, 21:54] h@rish!: solivr@harish-Inspiron-5421:~$ sudo apt-get update
[sudo] password for solivr:
Sorry, try again.
[sudo] password for solivr:
Sorry, try again.
[sudo] password for solivr:
[7/15, 21:55] h@rish!: solivr is not in the sudoers file.  This incident
will be reported.
[7/15, 21:55] h@rish!: Do u know how to solve it?
Thanks
Harish
On Jul 15, 2015 10:21 PM, "Auj Nizkgi"  wrote:

> Thank you for your help James. I have deleted the the folder the contained
> the framework and will be starting from scratch.
>
> I completed 'learn python the hard way' along with a few more beginner
> level courses for python. I'm sure you read or get this question daily, but
> what would you recommend is a good place to start for Django. I feel I need
> some more explanations and basic level knowledge than what's on the
> djangoproject. I want to create my own landing page that has sign in and
> log in features for a set of questions to be asked. Ultimately, I want to
> get familiar with Django. I started coding about 3 months ago and I have
> absorbed a lot considering my background prior experience.
>
> Any advice would be helpful. Thanks for all the support!
>
> On Tue, Jul 14, 2015 at 7:06 PM, James Schneider 
> wrote:
>
>> > When I run the shell, I keep getting errors. Also, I have created the
>> > question three times now so when I type q.id , I get a return value of
>> 3.
>> > How can I delete them. 
>>
>> Easy enough.
>>
>> q.delete()
>>
>> You may have to perform a query to gather up the other questions that
>> you've already created and perform delete operations on each of those.
>>
>>
>> >  Also when I ask the question text (q.question_text) I
>> > get "" instead of the "Whats up".
>>
>>
>> That is odd. I'd be interested to see the series of commands that you
>> are running to get this result. Can you paste everything that you are
>> typing into the shell and all of the responses? It's almost as though
>> you've done something like p.question_text = p before printing out p.
>>
>>
>> >
>> > Any help would be greatly appreciated.
>> >
>> > The error when I run the shell:
>> >
>> > q$ python manage.py shell
>> >
>> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
>> > RuntimeWarning: Model 'polls.question' was already registered. Reloading
>> > models is not advised as it can lead to inconsistencies, most notably
>> with
>> > related models.
>> >   new_class._meta.apps.register_model(new_class._meta.app_label,
>> new_class)
>> >
>> >
>> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
>> > RuntimeWarning: Model 'polls.choice' was already registered. Reloading
>> > models is not advised as it can lead to inconsistencies, most notably
>> with
>> > related models.
>> >   new_class._meta.apps.register_model(new_class._meta.app_label,
>> new_class)
>> >
>> > Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
>> > [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>> > Type "help", "copyright", "credits" or "license" for more information.
>> > (InteractiveConsole)
>> 
>> >
>>
>> While I've never seen this error before, it would seem that something
>> is amiss in your models.py and/or possibly your admin.py. I've seen a
>> few google posts saying that this error was received because they were
>> importing models in both models.py and in admin.py.
>>
>> Please post both files, along with your settings.py, which may shed
>> more light on the issue.
>>
>> -James
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/rkHCIznabR0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXKpkuF3nY%2BbLanHUEN1T9AEr%2B_0ZtbCk911U6krqqfsQ%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSjUQXOubVhT3yjW_6jvHF63MxXdQzojT7rfo52JwO-tDH21A%40mail.gmail.com
> 

Re: "RuntimeError: Error creating new content types."

2015-07-15 Thread Tomas Henriquez
I just fixed this issue by entering into my database directly, showed all 
rows on "django_migrations", I saw that I did migrated before the 
contenttypes (probably when I did a regression to django 1.4 for some 
tests). By deleting the rows with contenttypes on it, deleting the 
contenttypes table and running the migration again I was able to fix the 
issue.

On Wednesday, July 15, 2015 at 3:30:27 PM UTC-4:30, Chris DiLorenzo wrote:
>
> Hey Devang,
>
> No, we did not fake any migrations =(
>
> On Tuesday, June 23, 2015 at 12:58:46 AM UTC+2, Devang Mundhra wrote:
>>
>> Chris-
>> By any chance, did you fake any of the migrations. That was the problem I 
>> had faced- it wasn't a Django problem, it was a problem with my migration.
>>
>> On Mon, Jun 22, 2015 at 3:52 PM Chris DiLorenzo  
>> wrote:
>>
>>> I'm seeing this issue as well. Not sure if it helps but I get it when 
>>> running my tests.
>>>
>>> I chose to raise the error instead and saw this:
>>>
>>> django.db.utils.IntegrityError: null value in column "name" violates not
>>> -null
>>> constraint
>>> DETAIL:  Failing row contains (1, null, app, listing).
>>>
>>>
>>> Where app is the django app name and listing is the model name. So that 
>>> sounds to me like I'm seeing what everyone else is, the migration is just 
>>> not applied on the database for some reason, but shows as being applied OK.
>>>
>>> // Chris
>>>
>>>
>>> On Wednesday, June 10, 2015 at 11:31:42 AM UTC-4, Devang Mundhra wrote:
>>>
 In my case this is not a Django bug.
 The problem was that since 1.8 contenttypes started to have migrations. 
 But since the table already existed earlier, the migrations needed to be 
 faked.
 When faking the migrations, I used python manage.py migrate 
 contenttypes --fake which faked both 0001 and 0002.

 The fix was to remove the fake migration for 0002 from 
 django_migrations table and then do the actual migration.

 On Wed, Jun 10, 2015 at 6:57 AM Tim Graham  wrote:

>>> If anyone running into this problem can figure out why the 
> contrib.contenttypes migration (0002_remove_content_type_name) is being 
> marked as applied but not actually run in the database, that will help 
> determine if this is a bug in Django or a problem elsewhere.
>
>
> On Wednesday, June 10, 2015 at 7:11:48 AM UTC-4, Devang Mundhra wrote:
>>
>> I am getting the same error on Django v1.8.2 after migrating from 
>> v1.7.7
>> The underlying error is this-
>>
>> django.db.utils.IntegrityError: null value in column "name" violates 
>>> not-null constraint
>>> DETAIL:  Failing row contains (39, null, app_name, model_name).
>>>
>>>
>> On Friday, April 17, 2015 at 1:25:06 PM UTC-7, Tim Graham wrote:
>>>
>>> The contenttypes name column was removed in Django 1.8. Could you 
>>> retrieve the underlying exception before the RuntimeError is raised?
>>>
>>> On Friday, April 17, 2015 at 2:55:07 PM UTC-4, Christophe Pettus 
>>> wrote:

 Digging into this a bit more, the specific exception is that it is 
 trying to insert a contenttypes row with a null 'name' value. 

 The code in question is doing a get_or_create() on the contenttype 
 object.  I assume it should be picking up the name from the name 
 @property 
 on the ContentType model, but I don't see that ever actually being 
 called. 


 On Apr 17, 2015, at 11:24 AM, Christophe Pettus  
 wrote: 

 > On Django 1.8, I'm encountering this error when attempting to 
 apply migrations on the production system.  What's interesting is that 
 it 
 works fine on the dev system, and inspecting the django_migrations 
 table, I 
 don't see any (meaningful) differences between them (error text 
 below). 
 > 
 > There was a model added to the "catalog" application which is not 
 being created in django_content_type. 
 > 
 > Manually migrating contenttypes individually generates the same 
 error. 
 > 
 > -- 
 > 
 > $ python manage.py migrate 
 > Operations to perform: 
 >  Synchronize unmigrated apps: staticfiles, util, treebeard, 
 messages, office 
 >  Apply all migrations: info, customers, sessions, admin, 
 contenttypes, auth, sites, catalog, coming_soon, orders 
 > Synchronizing apps without migrations: 
 >  Creating tables... 
 >Running deferred SQL... 
 >  Installing custom SQL... 
 > Running migrations: 
 >  Rendering model states... DONE 
 >  Applying auth.0006_require_contenttypes_0002... OK 
 > Traceback (most recent call last): 
 >  File "manage.py", line 10, in  
 >

Re: "RuntimeError: Error creating new content types."

2015-07-15 Thread Chris DiLorenzo
Hey Devang,

No, we did not fake any migrations =(

On Tuesday, June 23, 2015 at 12:58:46 AM UTC+2, Devang Mundhra wrote:
>
> Chris-
> By any chance, did you fake any of the migrations. That was the problem I 
> had faced- it wasn't a Django problem, it was a problem with my migration.
>
> On Mon, Jun 22, 2015 at 3:52 PM Chris DiLorenzo  > wrote:
>
>> I'm seeing this issue as well. Not sure if it helps but I get it when 
>> running my tests.
>>
>> I chose to raise the error instead and saw this:
>>
>> django.db.utils.IntegrityError: null value in column "name" violates not-
>> null
>> constraint
>> DETAIL:  Failing row contains (1, null, app, listing).
>>
>>
>> Where app is the django app name and listing is the model name. So that 
>> sounds to me like I'm seeing what everyone else is, the migration is just 
>> not applied on the database for some reason, but shows as being applied OK.
>>
>> // Chris
>>
>>
>> On Wednesday, June 10, 2015 at 11:31:42 AM UTC-4, Devang Mundhra wrote:
>>
>>> In my case this is not a Django bug.
>>> The problem was that since 1.8 contenttypes started to have migrations. 
>>> But since the table already existed earlier, the migrations needed to be 
>>> faked.
>>> When faking the migrations, I used python manage.py migrate contenttypes 
>>> --fake which faked both 0001 and 0002.
>>>
>>> The fix was to remove the fake migration for 0002 from django_migrations 
>>> table and then do the actual migration.
>>>
>>> On Wed, Jun 10, 2015 at 6:57 AM Tim Graham  wrote:
>>>
>> If anyone running into this problem can figure out why the 
 contrib.contenttypes migration (0002_remove_content_type_name) is being 
 marked as applied but not actually run in the database, that will help 
 determine if this is a bug in Django or a problem elsewhere.


 On Wednesday, June 10, 2015 at 7:11:48 AM UTC-4, Devang Mundhra wrote:
>
> I am getting the same error on Django v1.8.2 after migrating from 
> v1.7.7
> The underlying error is this-
>
> django.db.utils.IntegrityError: null value in column "name" violates 
>> not-null constraint
>> DETAIL:  Failing row contains (39, null, app_name, model_name).
>>
>>
> On Friday, April 17, 2015 at 1:25:06 PM UTC-7, Tim Graham wrote:
>>
>> The contenttypes name column was removed in Django 1.8. Could you 
>> retrieve the underlying exception before the RuntimeError is raised?
>>
>> On Friday, April 17, 2015 at 2:55:07 PM UTC-4, Christophe Pettus 
>> wrote:
>>>
>>> Digging into this a bit more, the specific exception is that it is 
>>> trying to insert a contenttypes row with a null 'name' value. 
>>>
>>> The code in question is doing a get_or_create() on the contenttype 
>>> object.  I assume it should be picking up the name from the name 
>>> @property 
>>> on the ContentType model, but I don't see that ever actually being 
>>> called. 
>>>
>>>
>>> On Apr 17, 2015, at 11:24 AM, Christophe Pettus  
>>> wrote: 
>>>
>>> > On Django 1.8, I'm encountering this error when attempting to 
>>> apply migrations on the production system.  What's interesting is that 
>>> it 
>>> works fine on the dev system, and inspecting the django_migrations 
>>> table, I 
>>> don't see any (meaningful) differences between them (error text below). 
>>> > 
>>> > There was a model added to the "catalog" application which is not 
>>> being created in django_content_type. 
>>> > 
>>> > Manually migrating contenttypes individually generates the same 
>>> error. 
>>> > 
>>> > -- 
>>> > 
>>> > $ python manage.py migrate 
>>> > Operations to perform: 
>>> >  Synchronize unmigrated apps: staticfiles, util, treebeard, 
>>> messages, office 
>>> >  Apply all migrations: info, customers, sessions, admin, 
>>> contenttypes, auth, sites, catalog, coming_soon, orders 
>>> > Synchronizing apps without migrations: 
>>> >  Creating tables... 
>>> >Running deferred SQL... 
>>> >  Installing custom SQL... 
>>> > Running migrations: 
>>> >  Rendering model states... DONE 
>>> >  Applying auth.0006_require_contenttypes_0002... OK 
>>> > Traceback (most recent call last): 
>>> >  File "manage.py", line 10, in  
>>> >execute_from_command_line(sys.argv) 
>>> >  File 
>>> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>>>  
>>> line 338, in execute_from_command_line 
>>> >utility.execute() 
>>> >  File 
>>> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>>>  
>>> line 330, in execute 
>>> >self.fetch_command(subcommand).run_from_argv(self.argv) 
>>> >  File 
>>> 

Re: Playing with API- DjangoProject Part 1

2015-07-15 Thread Auj Nizkgi
Thank you for your help James. I have deleted the the folder the contained
the framework and will be starting from scratch.

I completed 'learn python the hard way' along with a few more beginner
level courses for python. I'm sure you read or get this question daily, but
what would you recommend is a good place to start for Django. I feel I need
some more explanations and basic level knowledge than what's on the
djangoproject. I want to create my own landing page that has sign in and
log in features for a set of questions to be asked. Ultimately, I want to
get familiar with Django. I started coding about 3 months ago and I have
absorbed a lot considering my background prior experience.

Any advice would be helpful. Thanks for all the support!

On Tue, Jul 14, 2015 at 7:06 PM, James Schneider 
wrote:

> > When I run the shell, I keep getting errors. Also, I have created the
> > question three times now so when I type q.id , I get a return value of
> 3.
> > How can I delete them. 
>
> Easy enough.
>
> q.delete()
>
> You may have to perform a query to gather up the other questions that
> you've already created and perform delete operations on each of those.
>
>
> >  Also when I ask the question text (q.question_text) I
> > get "" instead of the "Whats up".
>
>
> That is odd. I'd be interested to see the series of commands that you
> are running to get this result. Can you paste everything that you are
> typing into the shell and all of the responses? It's almost as though
> you've done something like p.question_text = p before printing out p.
>
>
> >
> > Any help would be greatly appreciated.
> >
> > The error when I run the shell:
> >
> > q$ python manage.py shell
> >
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
> > RuntimeWarning: Model 'polls.question' was already registered. Reloading
> > models is not advised as it can lead to inconsistencies, most notably
> with
> > related models.
> >   new_class._meta.apps.register_model(new_class._meta.app_label,
> new_class)
> >
> >
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
> > RuntimeWarning: Model 'polls.choice' was already registered. Reloading
> > models is not advised as it can lead to inconsistencies, most notably
> with
> > related models.
> >   new_class._meta.apps.register_model(new_class._meta.app_label,
> new_class)
> >
> > Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
> > [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> > Type "help", "copyright", "credits" or "license" for more information.
> > (InteractiveConsole)
> 
> >
>
> While I've never seen this error before, it would seem that something
> is amiss in your models.py and/or possibly your admin.py. I've seen a
> few google posts saying that this error was received because they were
> importing models in both models.py and in admin.py.
>
> Please post both files, along with your settings.py, which may shed
> more light on the issue.
>
> -James
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/rkHCIznabR0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXKpkuF3nY%2BbLanHUEN1T9AEr%2B_0ZtbCk911U6krqqfsQ%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSjUQXOubVhT3yjW_6jvHF63MxXdQzojT7rfo52JwO-tDH21A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1.7 to 1.8 upgrade: test suite failing

2015-07-15 Thread Tim Graham
A minimal project to reproduce the issue would be helpful.

On Wednesday, July 15, 2015 at 5:41:49 AM UTC-4, tom.sz...@eporta.com wrote:
>
> Unfortunately, adding the super() calls didn't help.
>
> On Tuesday, July 14, 2015 at 12:47:02 PM UTC+1, Tim Graham wrote:
>>
>> Please try adding the super() calls.
>>
>> On Tuesday, July 14, 2015 at 5:44:09 AM UTC-4, tom.sz...@eporta.com 
>> wrote:
>>>
>>> Hi, yes. Some of my test classes do use setUpClass() without calling 
>>> super().
>>>
>>> On Monday, July 13, 2015 at 5:44:03 PM UTC+1, Tim Graham wrote:

 Do your test classes use setUpClass() and/or tearDownClass()? If so, 
 are you missing super() calls in those methods?

 On Monday, July 13, 2015 at 9:37:03 AM UTC-4, tom.sz...@eporta.com 
 wrote:
>
> Thanks for the link
> This is the commit at which my tests start failing:
> da9fe5c Fixed #20392 -- Added TestCase.setUpTestData()
>
> On Monday, July 13, 2015 at 12:39:57 PM UTC+1, Tim Graham wrote:
>>
>> That's a starting point, but there are still a lot of commits between 
>> 1.8 and 1.7.x. Here's what I meant by "bisecting the commit":
>>
>>
>> https://docs.djangoproject.com/en/dev/internals/contributing/triaging-tickets/#bisecting-a-regression
>>
>> On Monday, July 13, 2015 at 5:50:49 AM UTC-4, tom.sz...@eporta.com 
>> wrote:
>>>
>>> Thanks for the swift reply. The problem starts with Django 1.8.0. My 
>>> test suite passes on all 1.7.x versions.
>>>
>>> On Friday, July 10, 2015 at 2:32:25 PM UTC+1, Tim Graham wrote:

 No ideas, but if you could bisect to find the Django commit where 
 the problem started to appear that will probably help.

 On Friday, July 10, 2015 at 7:21:37 AM UTC-4, tom.sz...@eporta.com 
 wrote:
>
> Hi,
>
> I've recently tried upgrading from Django 1.7.6 to 1.8.3 but 
> haven't been able to get my test suite to pass.
>
> My main problem is that all of the tests pass when run 
> individually, but when run as an entire test suite, many arbitraily 
> fail 
> due to an *InterfaceError: connection already closed*:
>
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py"
> , line 838, in execute_sql
> cursor = self.connection.cursor()
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py"
> , line 164, in cursor
> cursor = self.make_cursor(self._cursor())
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py"
> , line 137, in _cursor
> return self.create_cursor()
>   File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py"
> , line 97, in __exit__
> six.reraise(dj_exc_type, dj_exc_value, traceback)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py"
> , line 137, in _cursor
> return self.create_cursor()
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py"
> , line 212, in create_cursor
> cursor = self.connection.cursor()
> InterfaceError: connection already closed
>
>
>
> I was previously using psycopg2.6 with Postgres 9.3 and have tried 
> upgrading to psycopg2.6.1 with Postgres 9.4, but this hasn't helped.
>
> Forcing all my TestCase classes to inherit from SimpleTestCase 
> resolves this issue, but inheriting from SimpleTestCase isn't 
> something 
> that I wish to do.
>
> Any help would be much appreciated.
>
> Thanks,
>
> Tom
>


-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9138776c-0078-4e57-9e44-1965a3938fcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: preserve data when migrating ForeignKey to ManyToManyField

2015-07-15 Thread Erik Cederstrand

> Den 14/07/2015 kl. 23.32 skrev A Lee :
> 
> I'd like to change a ForeignKey field into a ManyToManyField, preserving 
> existing data by creating entries in the many-to-many through table. Running 
> makemigrations after changing the model class creates a migration that 
> executes a RemoveField on the existing ForeignKey field and then an AddField 
> on the new ManyToManyField, which destroys any existing ForeignKey data.
> 
> I ended up implementing this by creating three migrations:
> 
> 1. schema migration: create the new ManyToManyField
> 2. data migration: copy existing ForeignKey data into the ManyToManyField
> 3. schema migration: remove the ForeignKey field and rename the 
> ManyToManyField
> 
> Is there a simpler way to do this type of schema change?

No. AFAIK, this is the recommended and most robust and flexible way of making 
non-trivial changes to a model field definition.

If you have lots of data to migrate, you may need to optimize the data 
migration with e.g. raw SQL instead of the naive:

   for obj in MyModel.objects.all():
  obj.my_m2m.add(obj.my_fk)

Erik


-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52FB9F20-D170-4787-AB16-979008008A1A%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Celery to process task and modify the model fields

2015-07-15 Thread 'Tom Evans' via Django users
On Tue, Jul 14, 2015 at 9:15 PM, Robin Lery  wrote:
> Yes. That time you were the one to guide me. I was looking at other projects
> after that.
>
> I am just confused on how to get the video.mp4_720 to be the converted
> video. Will you please help.
>

This is explained in the docs for FileField, you need to create a
django.core.files.File subclass, and save() it on the FieldFile object
that is returned when you access the FileField field on your model
instance.

Eg:

from django.core.files import File
fp = open('/path/to/file')
myfile = File(fp)
my_obj.mp4_720.save(name="", content=myfile)

https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.fields.files.FieldFile.save

Also, you should not pass objects as arguments to celery tasks, you
should instead pass the id of the object and fetch the object again in
the celery task.

Cheers

Tom

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1J%2BGf_hRB7ERLonXpT_jhDqX8NkEYtV5qnftyMgKvJ0OA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1.7 to 1.8 upgrade: test suite failing

2015-07-15 Thread tom . szpytman
Unfortunately, adding the super() calls didn't help.

On Tuesday, July 14, 2015 at 12:47:02 PM UTC+1, Tim Graham wrote:
>
> Please try adding the super() calls.
>
> On Tuesday, July 14, 2015 at 5:44:09 AM UTC-4, tom.sz...@eporta.com wrote:
>>
>> Hi, yes. Some of my test classes do use setUpClass() without calling 
>> super().
>>
>> On Monday, July 13, 2015 at 5:44:03 PM UTC+1, Tim Graham wrote:
>>>
>>> Do your test classes use setUpClass() and/or tearDownClass()? If so, 
>>> are you missing super() calls in those methods?
>>>
>>> On Monday, July 13, 2015 at 9:37:03 AM UTC-4, tom.sz...@eporta.com 
>>> wrote:

 Thanks for the link
 This is the commit at which my tests start failing:
 da9fe5c Fixed #20392 -- Added TestCase.setUpTestData()

 On Monday, July 13, 2015 at 12:39:57 PM UTC+1, Tim Graham wrote:
>
> That's a starting point, but there are still a lot of commits between 
> 1.8 and 1.7.x. Here's what I meant by "bisecting the commit":
>
>
> https://docs.djangoproject.com/en/dev/internals/contributing/triaging-tickets/#bisecting-a-regression
>
> On Monday, July 13, 2015 at 5:50:49 AM UTC-4, tom.sz...@eporta.com 
> wrote:
>>
>> Thanks for the swift reply. The problem starts with Django 1.8.0. My 
>> test suite passes on all 1.7.x versions.
>>
>> On Friday, July 10, 2015 at 2:32:25 PM UTC+1, Tim Graham wrote:
>>>
>>> No ideas, but if you could bisect to find the Django commit where 
>>> the problem started to appear that will probably help.
>>>
>>> On Friday, July 10, 2015 at 7:21:37 AM UTC-4, tom.sz...@eporta.com 
>>> wrote:

 Hi,

 I've recently tried upgrading from Django 1.7.6 to 1.8.3 but 
 haven't been able to get my test suite to pass.

 My main problem is that all of the tests pass when run 
 individually, but when run as an entire test suite, many arbitraily 
 fail 
 due to an *InterfaceError: connection already closed*:

   File 
 "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py"
 , line 838, in execute_sql
 cursor = self.connection.cursor()
   File 
 "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py"
 , line 164, in cursor
 cursor = self.make_cursor(self._cursor())
   File 
 "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py"
 , line 137, in _cursor
 return self.create_cursor()
   File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", 
 line 97, in __exit__
 six.reraise(dj_exc_type, dj_exc_value, traceback)
   File 
 "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py"
 , line 137, in _cursor
 return self.create_cursor()
   File 
 "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py"
 , line 212, in create_cursor
 cursor = self.connection.cursor()
 InterfaceError: connection already closed



 I was previously using psycopg2.6 with Postgres 9.3 and have tried 
 upgrading to psycopg2.6.1 with Postgres 9.4, but this hasn't helped.

 Forcing all my TestCase classes to inherit from SimpleTestCase 
 resolves this issue, but inheriting from SimpleTestCase isn't 
 something 
 that I wish to do.

 Any help would be much appreciated.

 Thanks,

 Tom

>>>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eb6efafc-8c63-40c4-91d8-b53d24bf670b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.