Re: how to upload file with pjango

2016-06-01 Thread meInvent bbird
wonderful, this code succeed to run On Wednesday, June 1, 2016 at 9:14:14 PM UTC+8, Wyrven no L2Radamanthys wrote: > > I suggest redefining the form > > class UploadFileForm(forms.Form): > title = forms.CharField(max_length=50) > file2 = forms.FileField() > MAX_FILE_SIZE =

Re: Django Project Structure for mixins - best solution?

2016-06-01 Thread Mike Dewhirst
On 2/06/2016 12:54 AM, sevenrrain...@gmail.com wrote: I seen multiple project structure for Django, but they didn't discuss in detail about structuring mixins. I see that some people use mixins.py , others utils folder. Taking in consideration that I have many mixins for views(generic

Re: Model inheritance with constraints

2016-06-01 Thread Arnab Banerji
Nevermind my last comment on this thread, when I refactored my existing model into an abstract base class with overrides, and then ran "makemigrations", Django said "no changed detected", so it is merely treated as a code refactor and not a database related change. Thanks AB -- You received

Re: Views.py & template (queryset)

2016-06-01 Thread Stephen J. Butler
>From the template language reference: < https://docs.djangoproject.com/en/1.9/ref/templates/language/#accessing-method-calls > """ Because Django intentionally limits the amount of logic processing available in the template language, it is not possible to pass arguments to method calls accessed

Views.py & queryset

2016-06-01 Thread Franck
Hello, Sorry first project... I can run : *Test.objects.filter(dateregister__contains='2016').count()in manage.py shell, result is ok.*In template, *{{ test.count }} *works well, but I tried *{{ *test.filter(dateregister__contains='2016').count()* }} *without success. *I can't use

Views.py & template (queryset)

2016-06-01 Thread Franck
Hello, First Django project... sorry ;-) I can run that in manage.py shell, result is ok. * Test.objects.filter(dateregister__contains='2016').count()* But how I can show this result in the template ? {{ test.count }} works directly in the template without modify views.py, I tried with

Django Project Structure for mixins - best solution?

2016-06-01 Thread sevenrrainbow
I seen multiple project structure for Django, but they didn't discuss in detail about structuring mixins. I see that some people use mixins.py , others utils folder. Taking in consideration that I have many mixins for views(generic login,authorization and more specific for the project) and

Re: Django websites for study and improvement

2016-06-01 Thread Tim Graham
You might enjoy looking at djangoproject.com itself: https://github.com/django/djangoproject.com/ On Tuesday, May 31, 2016 at 1:56:39 PM UTC-4, Ankush Thakur wrote: > > Are there any large-ish (I mean, beyond blogs, polls, etc.) websites (web > apps?) out there that are open source and can help

Re: Why are models must for permissions?

2016-06-01 Thread Tim Graham
It's a know limitation: https://code.djangoproject.com/ticket/24754 Maybe http://stackoverflow.com/questions/13932774/how-can-i-use-django-permissions-without-defining-a-content-type-or-model helps. On Wednesday, June 1, 2016 at 10:32:12 AM UTC-4, Ankush Thakur wrote: > > Why are all

Why are models must for permissions?

2016-06-01 Thread Ankush Thakur
Why are all permissions linked to a model? I'm just learning the basics of permissions and wanted to set up a quick example where I wanted to have a single user who belongs to a group that has permission to access restricted content, let's say. So far I have created a group and added the user

Re: Model inheritance with constraints

2016-06-01 Thread Arnab Banerji
Hi Akhil - my issue was how to avoid the new OneToOne relationships, which James addressed on this post. Hi James - thanks a bunch for your help, much appreciated. While I like the WYSIWYG nature of this solution, I am not sure if the creation of the abstract base class will cause the data

Django 1.9 - Create an app that use the models from another app and dynamic CBV

2016-06-01 Thread sevenrrainbow
I'm creating a basic CMS. The CMS will contain information about different Entities. A normal users can only see the information about the Entities but an editor will have access to an Dashboard were it can add new Entities or updated them. I have an app Entity that use class-based view

Re: Django API CSRF Issues - Need Help

2016-06-01 Thread Neeraj Gahlot
Hi Chris, You will have to pass csrf token in http request header while making request using AJAX This can be done by adding following prior to your ajax request. var csrftoken = $.cookie('csrftoken'); $.ajaxSetup({ headers: { "X-CSRFToken": csrftoken } }); On Saturday, May 21, 2016 at

Re: how to upload file with pjango

2016-06-01 Thread Ricardo Daniel Quiroga
I suggest redefining the form class UploadFileForm(forms.Form): title = forms.CharField(max_length=50) file2 = forms.FileField() MAX_FILE_SIZE = forms.CharField(widget=forms.HiddenInput(), initial = 1) and in template upload.html you tried this? Title {{ form.title }}

Re: Enabling admin interface

2016-06-01 Thread C.J.S. Hayward
I see that Gmail clipped my message on the display image, probably due to my quoting my whole Pinax urls. Here's a streamlined version: -- I am building and customizing a Pinax site, and wish to customize the page title (now all page titles begin with "Pinax Social Demo"). An ack though the

Enabling admin interface

2016-06-01 Thread C.J.S. Hayward
I am building and customizing a Pinax site, and wish to customize the page title (now all page titles begin with "Pinax Social Demo"). An ack though the project and the virtualenv found the string "Pinax Social Demo" found the project's fixtures/initial_data.json but changing the value there did

Re: Drawing simple objects in Django using canvas

2016-06-01 Thread Derek
My sense is that javascript for this type of application *is* going to be complex; but if you need, you will have to learn it. There's also go.js - e..g http://gojs.net/latest/learn/index.html On Monday, 30 May 2016 01:24:16 UTC+2, Nemanja Milosavljevic wrote: > > > > down votefavorite >

Re: change display value of filter in admin

2016-06-01 Thread Derek
You need to use a Django SimpleListFilter; e.g. see http://gpiot.com/blog/django-cookbook-custom-admin-list-filters/ or https://www.elements.nl/2015/03/16/getting-the-most-out-of-django-admin-filters/ On Tuesday, 31 May 2016 13:52:06 UTC+2, Brad Rice wrote: > > I have a field that has two

Re: Adding view permission by default to auth_permission

2016-06-01 Thread Derek
My own observation, from years on this mailing list, is that the dev team do not consider this a must-have for Django; their view (as far as I understand it!) is that the admin is designed for trusted users, so simply do not let them have access at all. Having said that, there is a pull

Re: Authenticating a user without retrieving or saving from a database

2016-06-01 Thread monoBOT
Users without users ... maybe you can use personalized cookies so you keep track of recurrent visits without any kind of database 2016-06-01 8:12 GMT+01:00 Rajesh Khan : > My objective is to authenticate a user from a custom authentication > system. > > I am not sure

Authenticating a user without retrieving or saving from a database

2016-06-01 Thread Rajesh Khan
My objective is to authenticate a user from a custom authentication system. I am not sure how I could create a user object without creating a user in the database. If I do something like this *u =User.objects.create_user('john', 'len...@thebeatles.com', 'johnpassword')* the above fails and