Django - Upload PDF and Excel file to mysql database

2018-08-15 Thread Sainath Bavugi
I have written a code to upload an excel sheet and save the contents to MySQL database. Below is the code to upload the file in memory. form = UploadFileForm(request.POST,request.FILES) if form.is_valid(): file_in_memory = request.FILES['file'].read() wb = load_workbook(filename=BytesIO(file

Help is outdated

2018-08-15 Thread Olivier Pons
Here https://docs.djangoproject.com/en/2.1/intro/tutorial01/ You can find things like def index(request): return HttpResponse("Hello, world. You're at the polls index.") and then on tutorial 03, you get def detail(request, question_id): return HttpResponse("You're looking at question

'makemigrations --name initial app ' problem. How to solve it?

2018-08-15 Thread Vikrant Gupta
I'm using Django with pymysql. Having troubles in makemigrations in terminal. I did right_click on the project name-> open in Terminal-> Type "python manage.py makemigrations --name initial app". Then it showed me the error. I attached the screenshot of the error. How can I solve it? Need Help,

Re: Help is outdated

2018-08-15 Thread Jason
The tutorial is an easy introduction to the basics of django. A MVP, if you will. Introducing a new user to generics in the very first tutorial when they don't have any concept of what it means is counterintuitive to learning because they don't have any concept of what it means without gettin

Re: 'makemigrations --name initial app ' problem. How to solve it?

2018-08-15 Thread Jason
that error means you haven't added your django application name to the INSTALLED_APPS dict in your project settings. -- 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

Re: 'makemigrations --name initial app ' problem. How to solve it?

2018-08-15 Thread Vikrant Gupta
How to add the application name to Installed apps dict? On Wednesday, August 15, 2018 at 4:55:00 PM UTC+5:30, Jason wrote: > > that error means you haven't added your django application name to the > INSTALLED_APPS dict in your project settings. > -- You received this message because you are su

Re: 'makemigrations --name initial app ' problem. How to solve it?

2018-08-15 Thread Vikrant Gupta
Thank you so much ! I got it. On Wednesday, August 15, 2018 at 4:55:00 PM UTC+5:30, Jason wrote: > > that error means you haven't added your django application name to the > INSTALLED_APPS dict in your project settings. > -- You received this message because you are subscribed to the Google Gro

App Registeries Not ready

2018-08-15 Thread Vikrant Gupta
I'm trying to get a name from a column named Artist. But got an error in using get(). The code is as follows... from django.db import models # Create your models here. class Artist(models.Model): name=models.CharField('artist',max_length=50,primary_key=True) year_formed=models.Positive

Re: django

2018-08-15 Thread Vikrant Gupta
Try the following steps, hope it will workout... 1. Right click on Project folder 2. Open Command Prompt here. 3. and Type 'python manage.py makemigrations --name initial polls' (in place of polls , you can put your application name) But remember before step 3. 'polls' should be added in INSTALLE

Re: App Registeries Not ready

2018-08-15 Thread Jason
I suggest you do that in the django shell in the terminal, not in the model code. -- 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...@goog

Re: App Registeries Not ready

2018-08-15 Thread Vikrant Gupta
Sure. May I know what’s the reason not to use in model code? So How can I develop my project? With thanks , Vikrant > On Aug 15, 2018, at 6:38 PM, Jason wrote: > > I suggest you do that in the django shell in the terminal, not in the model > code. > > -- > You received this message becaus

Re: App Registeries Not ready

2018-08-15 Thread Shashank Parekh
Can you post your apps.py file? On Wednesday, August 15, 2018 at 6:22:34 PM UTC+5:30, Vikrant Gupta wrote: > > I'm trying to get a name from a column named Artist. But got an error in > using get(). > The code is as follows... > > from django.db import models > # Create your models here. > > >

App Registeries not ready

2018-08-15 Thread Vikrant Gupta
I'm trying to get a name from a column. the code is as following... but got an error by using get(id=1) as shown in screenshot. I'm using Django 2.1 and Python version 3.7 on Pycharm. from django.db import models # Create your models here. class Artist(models.Model): name=models.CharField('a

Re: App Registeries Not ready

2018-08-15 Thread Vikrant Gupta
Yeah... Here it's from django.apps import AppConfig class PollsConfig(AppConfig): name = 'polls' On Wednesday, August 15, 2018 at 7:12:50 PM UTC+5:30, Shashank Parekh wrote: > > Can you post your apps.py file? > > On Wednesday, August 15, 2018 at 6:22:34 PM UTC+5:30, Vikrant Gupta wrote:

Compiling django filters into a variable and executing it at runtime?

2018-08-15 Thread Joel
I'm trying to write a search function for my model. A customer has the following fields: cstid = models.AutoField(primary_key=True, unique=True) name = models.CharField(max_length=35) age=models.IntegerField() gender = models.CharField(max_length=10, default='') mobile = models.CharField(max_lengt

changing the django production from 80 to another

2018-08-15 Thread Kamal Sharma
Hey Django, I am facing a problem that at 80 port my tomcat is running and i just want to deploy my django application on the same server so how can i change the port number please help me. Thanks Kamal Sharma -- You received this message because you are subscribed to the Google Groups "Django

RE: Compiling django filters into a variable and executing it at runtime?

2018-08-15 Thread Matthew Pava
I would take advantage of keyword arguments and dictionary expansion notation. I would use something like this: fields = ['cstid', 'age', 'gender', 'city'] search_query_and = {} search_query_or = Q() for f in fields: if request.POST.get(f): search_query_and[f"{f}__contains"] = request.

User is not working as foreign Key after the Custom model

2018-08-15 Thread Anirudh choudhary
I have try every thing like (settings.AUTH_USER_MODEL and get_user-model() , User importing from accounts app but when i create hero i always get User as None) #this is my hero app models file from django.db import models from django.conf import settings from accounts.models import User from dja

Help with DetailView

2018-08-15 Thread Carlos Wilfrido Montecinos
Hello all! I'm new in Django and have some problems understanding how I made this DetaiView work. I started changing my FBV to GCBV. This one, that the only thing it does is group articles by a tag: def tag(request, tag_name): > tag = get_object_or_404(Tag, tag_name=tag_name) > articles = tag.

Re: App Registeries Not ready

2018-08-15 Thread Kasper Laudrup
Hi Vikrant, On 15/08/2018 15.11, Vikrant Gupta wrote: Sure. May I know what’s the reason not to use in model code? I'm far from being an expert in Django, so I don't know the details, but I'm sure Django does quite a lot of "magic" when you write a class that inherits from models.Model which

Re: App Registeries Not ready

2018-08-15 Thread Vikrant Gupta
Thank you so much for patiently explanation on my question. I’ll try to do it. With thanks, Vikrant > On Aug 15, 2018, at 10:16 PM, Kasper Laudrup wrote: > > Hi Vikrant, > > On 15/08/2018 15.11, Vikrant Gupta wrote: >> Sure. May I know what’s the reason not to use in model code? > > I'm far f

Re: changing the django production from 80 to another

2018-08-15 Thread Kasper Laudrup
Hi Kamal, On 15/08/2018 16.32, Kamal Sharma wrote: I am facing a problem that at 80 port my tomcat is running and i just want to deploy my django application on the same server so how can i change the port number please help me. This is not really related to Django but more of a web server a

Re: App Registeries not ready

2018-08-15 Thread Mikhailo Keda
Are you sure it has id = 1? check the documentation - https://docs.djangoproject.com/en/2.1/ref/models/querysets/#django.db.models.query.QuerySet.get -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop rece

Re: App Registeries not ready

2018-08-15 Thread Julio Biason
Hi Vikrant, Is that the code of your models.py? 'Cause you have mixed the model definition with model usage in the same file and that won't work -- you'll get the message you're getting, about the models not being loaded yet, 'cause Django just read the model definition, but hasn't set up the data

DEBUG=False but still "Starting development server" ?!

2018-08-15 Thread Richard Belew
i've set DEBUG=False, and also echo its value at the end of my settings.py file to confirm it's been set correctly. Still I get: Django version 2.1, using settings 'showCrime.settings' > Starting development server at ... > why would that be?! -- You received this message because you are subs

Re: DEBUG=False but still "Starting development server" ?!

2018-08-15 Thread ireoluwa fakeye
You have to restart the application or restart the server as the case may be On Wed, 15 Aug 2018, 19:23 Richard Belew, wrote: > i've set DEBUG=False, and also echo its value at the end of my settings.py > file to confirm it's been set correctly. > Still I get: > > Django version 2.1, using set

Re: DEBUG=False but still "Starting development server" ?!

2018-08-15 Thread Richard Belew
yup, restarted apache. still development(: On Wednesday, August 15, 2018 at 11:26:03 AM UTC-7, ireoluwa fakeye wrote: > > You have to restart the application or restart the server as the case > may be > > > -- You received this message because you are subscribed to the Google Groups "Django

Re: DEBUG=False but still "Starting development server" ?!

2018-08-15 Thread ireoluwa fakeye
I'm confused on what the problem is .as long as it's a development server it will still show the above configuration On Wed, 15 Aug 2018, 19:33 Richard Belew, wrote: > yup, restarted apache. still development(: > > On Wednesday, August 15, 2018 at 11:26:03 AM UTC-7, ireoluwa fakeye wrote: >>

Re: DEBUG=False but still "Starting development server" ?!

2018-08-15 Thread Richard Belew
following https://docs.djangoproject.com/en/2.1/ref/settings/#debug i believe changing `settings.DEBUG` to `False` should make it a production server? On Wednesday, August 15, 2018 at 11:39:54 AM UTC-7, ireoluwa fakeye wrote: > > I'm confused on what the problem is .as long as it's a development

Re: DEBUG=False but still "Starting development server" ?!

2018-08-15 Thread Julio Biason
Hi Richard, No, that just suppresses the DEBUG messages, either in logs as in views. To have a production server, you need to deploy with wsgi: https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ . On Wed, Aug 15, 2018 at 3:48 PM, Richard Belew wrote: > following https://docs.djangopr

Re: DEBUG=False but still "Starting development server" ?!

2018-08-15 Thread ireoluwa fakeye
No it doesn't . It's clearly stated that it's only when you deploying the app that you should set debug to false this would not make any error show On Wed, 15 Aug 2018, 19:49 Richard Belew, wrote: > following https://docs.djangoproject.com/en/2.1/ref/settings/#debug > i believe changing `sett

Trying to make an employee clock-in/clock-out app...

2018-08-15 Thread Alexander Joseph
I'm trying to make an employee clock-in/clock-out app but running into some problems. Here is my model... class ClockPunch(models.Model): employee = models.ForeignKey(settings.AUTH_USER_MODEL) date = models.DateField(auto_now_add=True) punched_in = models.BooleanField(default=False)

Re: 3719: 'utf8' is currently an alias for the character set UTF8MB3, which will be replaced by UTF8MB4 - When using MySQL sakila and world DB examples

2018-08-15 Thread Ciaran O'Sullivan
I raised this with Django: https://code.djangoproject.com/ticket/29678 It is a MySQL 8 feature that inspectdb seems unable to tolerate.The information_schema is still utf8 not utf8mb3 or utf8mb4 Using MySQL 8 for a college project, have My Schema nailed and was going to use Django to display inf

Re: App Registeries not ready

2018-08-15 Thread Vikrant Gupta
OK thank you. Will you please tell me how to call shell in Pycharm on Mac. I've been searching for it so long unfortunately couldn't make it yet. On Wednesday, August 15, 2018 at 11:45:38 PM UTC+5:30, Julio Biason wrote: > > Hi Vikrant, > > Is that the code of your models.py? 'Cause you have mixe

Re: App Registeries not ready

2018-08-15 Thread Vikrant Gupta
I did according to documentation. but couldn't able to do it? It'll be better for me if you just give me an example of my uploaded code. Thank you! On Wednesday, August 15, 2018 at 11:40:46 PM UTC+5:30, Mikhailo Keda wrote: > > Are you sure it has id = 1? > > check the documentation - > https:/

Re: App Registeries not ready

2018-08-15 Thread Glen D souza
1.open your django project 2.open the terminal in pycharm, it is located at bottom left corner 3. in the terminal change the directory to the location where manage.py is located 4. type the following python3.7 manage.py shell On Thu, 16 Aug 2018 at 10:20, Vikrant Gupta wrote: > I did according