Re: Changing table name in response to a QuerySet

2015-03-22 Thread Peter of the Norse
I’m not sure I explained myself that well. Our system has two models, Product and ProductSearch. The Product tables come from third party sources, and can’t be edited from the front end. Users can setup their own ProductSearches, which are then used to construct the queryset. So our code

Re: Why is appearance of admin page so different between development and deployment servers?

2015-03-22 Thread talex
I apologize for the confusion, but I have ended up following Andreson's advise and used "python manage.py collectstatic" to generate a directory that I uploaded to my Apache server. That captured all the files needed for admin, and after I got my httpd.conf file right, it worked correctly. I

Re: Why is appearance of admin page so different between development and deployment servers?

2015-03-22 Thread Mike Dewhirst
On 23/03/2015 9:54 AM, talex wrote: On second thought maybe using /python3.3/site-packages/django/contrib/admin/static/admin directly is not the best practice. I tried using collectstatic, but then the admin could not find it. Please comment. Here is a collectstatic incantation which works

Re: Why is appearance of admin page so different between development and deployment servers?

2015-03-22 Thread talex
On second thought maybe using /python3.3/site-packages/django/contrib/admin/static/admin directly is not the best practice. I tried using collectstatic, but then the admin could not find it. Please comment. On Sunday, March 22, 2015 at 3:33:21 PM UTC-7, talex wrote: > > All, > > Thank you.

Re: Why is appearance of admin page so different between development and deployment servers?

2015-03-22 Thread talex
All, Thank you. I had negeleted to enable file serving on Apache for ../python3.3/site-packages/django/contrib/admin/static/admin I added the stanza: Alias /static/admin ../python3.3/site-packages/django/contrib/admin/static/admin Require all granted to Apaches's httpd.conf, and

Re: migrations don't work

2015-03-22 Thread James Schneider
I think the end of the traceback is pretty telling: ValueError: Lookup failed for model referenced by field quedar.LearningGroup.members: quedar.User You have a LearningGroup model with an attribute called members which is still referencing the original User model that was removed. -James On

Re: migrations don't work

2015-03-22 Thread Markus Holtermann
Hi, from the information you provided I can only guess you are migrating away from a custom user model to the "normal" Django user model. This won't work (out of the box). And even the way to migrate from the Django user model to a custom user model is more of a workaround than a solution.

Re: migrations don't work

2015-03-22 Thread Vijay Khemlani
Judging from the makemigrations output, you deleted a model (User) but also added it as a foreignkey field to another model (Persona), is that what you wanted? On Sun, Mar 22, 2015 at 3:16 PM, wrote: > Hi, > > makemigrations works but migrate does not: > > [xan@mercuri

migrations don't work

2015-03-22 Thread somenxavier
Hi, makemigrations works but migrate does not: [xan@mercuri gargamella]$ python manage.py makemigrations Migrations for 'quedar': 0003_auto_20150322_1813.py: - Create model Persona - Delete model User - Add field user to persona - Alter field members on dialectgroup - Alter

Re: Max_length of EmailField in django.contrib.auth.models.User

2015-03-22 Thread Anderson Resende
I will give you one more complete example: Custom a User is not easy you need to do many things: In that link django-docs explain all for you and there is an example with email field. https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#a-full-example My tip is: In the docs there is

Re: Max_length of EmailField in django.contrib.auth.models.User

2015-03-22 Thread Anderson Resende
You can inheriant of AbstractBaseUser and define your field: from django.contrib.auth.models import AbstractBaseUser class MyCustomUser(AbstractBaseUser): mail = models.EmailField(max_lenght=254) REQUIRED_FIELDS = ['mail'] # more code Please sorry about my english, I'm a

Re: Max_length of EmailField in django.contrib.auth.models.User

2015-03-22 Thread somenxavier
Is it the same if I want to specify email as required field, isn't? El diumenge, 22 març de 2015 15:55:33 UTC+1, Tim Graham va escriure: > > Currently you need to use a custom user model if you want to change the > username max_length. There's an open ticket to increase the default length > to

Re: Max_length of EmailField in django.contrib.auth.models.User

2015-03-22 Thread François Schiettecatte
Hi I have been using this patch to get around the short user name (which is 30 characters): #-- # # Patch to allow username to exceed the default maximum of 30 characters # # http://stackoverflow.com/a/6453368/1228131 # #

Re: Max_length of EmailField in django.contrib.auth.models.User

2015-03-22 Thread Tim Graham
Currently you need to use a custom user model if you want to change the username max_length. There's an open ticket to increase the default length to 254 though: https://code.djangoproject.com/ticket/20846 On Sunday, March 22, 2015 at 10:45:34 AM UTC-4, somen...@gmail.com wrote: > > Thanks,

Re: Max_length of EmailField in django.contrib.auth.models.User

2015-03-22 Thread somenxavier
Thanks, Anderson, but can I overwrite the length of User class? How? Sorry I'm still a newbee? With AbstractUser? [https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#django.contrib.auth.models.CustomUser] or Extending user class

Re: Why is appearance of admin page so different between development and deployment servers?

2015-03-22 Thread Anderson Resende
Em production you need to run the command: python manage.py collectstatic and you need configure your production serve like "apache" to read the 'static' folder in you root project. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Max_length of EmailField in django.contrib.auth.models.User

2015-03-22 Thread Anderson Resende
No, the user class uses 75. You need to change to 254. models.EmailField(max_lenght=254) > > -- 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

Re: Why is appearance of admin page so different between development and deployment servers?

2015-03-22 Thread Ishaan Bahal
Take a look at your production server log, you may find that your static files aren't actually being served by your production server. This also happens when you set debug=False in settings.py. Visit https://docs.djangoproject.com/en/1.7/howto/static-files/deployment/ to setup static files

Max_length of EmailField in django.contrib.auth.models.User

2015-03-22 Thread somenxavier
Hi, The User class in https://docs.djangoproject.com/en/1.7/ref/contrib/auth/#django.contrib.auth.models.User is using EmailField with 254 max_length? I want to follow RFC (See https://docs.djangoproject.com/en/1.7/ref/models/fields/#emailfield) Thanks, -- You received this message because

Image in Form Field

2015-03-22 Thread Sandeep kaur
Greetings, I want to have the thumnails of images with the names in the dropdown field of form. To return the image as foreign key field, I have used this code : def __unicode__(self): image_data = open("/home/sandy/whats-fresh-api/media/images/download.jpg", "rb").read() return

Data migration script populating db table - testing

2015-03-22 Thread Murthy Sandeep
Hi I have created an data migration script for populating one of app db tables with data from a JSON file. First I ran python manage.py makemigrations --empty TPP_App (‘TPP_App’ is the name of my app) and then I added a custom method called populate_db which will use bulk_create to add