Re: Guidance for contributing to django

2017-09-25 Thread James Schneider
On Sep 25, 2017 2:05 PM, "KUNAL SINGHAL" wrote: As our minor project for the year, we were asked to contribute to Django. However, the problem with this is that I don't really know where to start. I have read the documentation, but still need guidance about what to do,

Re: Best option to check and/or convert encoding for csv files

2017-09-25 Thread Mike Dewhirst
On 26/09/2017 1:53 AM, Fellipe Henrique wrote: Thanks Mike, But my problem Ithink is more deep... I use pyexcel to try to open a CSV file, to work with that on my software... I receive these error everytime: 'utf-8' codec can't decode byte 0xa1 in position 14: invalid start byte my code

Re: CharField vs ImageField for Logo

2017-09-25 Thread tango ward
Hi Andreas, I was able to display the images but I dont know how they work. I checked some online resources and found out that I need to add these in my urls.py from django.conf import settings from django.conf.urls.static import static and at the bottom of it, I added if settings.DEBUG:

Re: CharField vs ImageField for Logo

2017-09-25 Thread tango ward
Hi Andreas, Really appreciate your guidance on this. I am having trouble understanding this: 3: All that will be stored in your database is a path to the file (relative to MEDIA_ROOT ). You’ll most likely want to use

Re: Channels: Using `allowed_hosts_only` with `WebsocketDemultiplexer`

2017-09-25 Thread Andrew Godwin
It's pretty tough right now to use the decorators with the classes (this is why things like http_user are built-in) - you have to wrap them around the handle method, if I remember correctly. I'm hoping to fix this with the design of Channels 2 by changing the way classes get called, but that's

POST method on localhost

2017-09-25 Thread Allan
I've created a simple form for data upload. I'm testing it through localhost and was wondering if this is realistic. Web development is a new area for me so bare with me please if this is a laughable question. I uploaded a 1GB file and it was uploaded and moved to a folder in my project in

Guidance for contributing to django

2017-09-25 Thread KUNAL SINGHAL
As our minor project for the year, we were asked to contribute to Django. However, the problem with this is that I don't really know where to start. I have read the documentation, but still need guidance about what to do, specifically: 1. Low-level features that can be added to Django in around

Channels: Using `allowed_hosts_only` with `WebsocketDemultiplexer`

2017-09-25 Thread Michael Huang
Hi there. I couldn't figure out how to use the allowed_hosts_only decorator with the connect method of WebsocketDemulitplexer. I ended up copying and pasting the relevant code into a mixin I could use directly with WebsocketDemultiplexer (removing __init__ and __call__, adding a connect method

Need help formatting and incrementing a form in HTML

2017-09-25 Thread Zev
OK so I have a running form in Django that updates the model and displays this on the page, but I was hoping to better format it. What happens is that the page displays all data imputed in the form. What I want to do is to numerically list it. This is what I have in my home.html right now:

Re: CharField vs ImageField for Logo

2017-09-25 Thread Andréas Kühne
Hi, I think you've made a lot of progress! The only thing I think you are missing now is that you should be using the following in your template: See: https://docs.djangoproject.com/en/1.11/ref/models/fields/#filefield and

Re: CharField vs ImageField for Logo

2017-09-25 Thread tango ward
Hi Andréas, Thank you for the response. I added these lines in my settings.py MEDIA_DIR = os.path.join(BASE_DIR, 'media') # Media MEDIA_ROOT = MEDIA_DIR MEDIA_URL = '/media/ Then I changed my logo to models.ImageField(upload_to='team_logo'). I also created a 'media' folder inside my project

Re: How to clean a form which receives multiple files

2017-09-25 Thread Tim Graham
There's a pull request to allow FileField(multiple=True): https://github.com/django/django/pull/9011 On Monday, September 25, 2017 at 4:19:24 AM UTC-4, guettli wrote: > > thank you very much for your Feedback! > > Am Freitag, 22. September 2017 18:24:23 UTC+2 schrieb mike: >> >> I do it this way

Re: server connection reset when click on localhost: Python error: wsgiref-> simple_server.py "noneType" object has no attribute split

2017-09-25 Thread 'Chris Parry' via Django users
What was the package you were missing? On Tuesday, 22 March 2016 00:01:11 UTC, amarshall wrote: > > Figured it out.. In case anyone else was wondering or comes across this. I > went into the wsgiref/simple_server.py file and commented out that line of > code: >

Re: best practices for location of start up code

2017-09-25 Thread Larry Martell
On Sat, Sep 23, 2017 at 6:21 PM, Antonis Christofides wrote: > Hello Larry, > > The Django development server runs in more than one thread, which is probably > why your initialization code run twice. > > OTOH, it run only once on production probably because you have

Re: CSRF and API Calls

2017-09-25 Thread Tom Gorup
The view for csrf token is what I'm testing out now. I created a standard GET handler which should be returning the CSRF token. I was hoping to see how others have solved the problem. Possibly more elegantly that a "pre" GET to the POST just to obtain the CSRF token; however, at the same time I

Re: CharField vs ImageField for Logo

2017-09-25 Thread Andréas Kühne
Hi, There are a couple of things to think about here. First of all - just because you put an item on your computer doesn't mean that the icon can be served. For example, if you are running windows and you enter 'C:\pictures\icon.jpg' as the source for the icon, your server won't be able to find

CharField vs ImageField for Logo

2017-09-25 Thread tango ward
Hi guys, I am new to django currently stuck in these two. I am writing my pet project which will display a Team name and their logo. I used these lines for my Team class in mode.spy class Team(models.Model): name = models.CharField(max_length=150) logo = models.CharField(null=True,

Weird issue in outputting CSV files for downloading in django

2017-09-25 Thread BIJAL MANIAR
Hi, I want my view to respond with a file for downloading, so that the browser pops up the download/file save dialog. I am using the 'Content-Disposition' header to specify the name of the file. When I use the django development server, it works perfectly fine in all browsers When I run it on

Re: How to clean a form which receives multiple files

2017-09-25 Thread guettli
thank you very much for your Feedback! Am Freitag, 22. September 2017 18:24:23 UTC+2 schrieb mike: > > I do it this way too and agree that it feels dirty. Curious to hear what > others have to say about this! > > On Fri, Sep 22, 2017 at 9:18 AM, guettli > wrote: > >> I am

Re: Rendering DataBase Image File

2017-09-25 Thread James Schneider
On Sep 24, 2017 11:55 AM, "yingi keme" wrote: Okk. I will like to know how to set the MEDIA_ROOT and MEDIA_URL.? And then, my images are uploaded to a directory named 'img' inside my static files directory. Does it affect how you set the MEDIA_ROOT and MEDIA_URL? Yes. The