Re: django.contrib.auth doesn't support template context processors?

2015-01-21 Thread James Schneider
Hmm, I stand corrected: https://github.com/django/django/blob/1.7.3/django/template/response.py#L156 It does render the context via RequestContext(). However, I can also point out why I thought I was right (in addition to my apparently flawed/rushed test): https://github.com/django/django/blob/

Re: sending email

2015-01-21 Thread sum abiut
Thanks, I am trying to send email to the users that their email address is stored in the database on the auth_user table. can someone please point me to the right direction. Cheers, On Thu, Jan 22, 2015 at 3:03 PM, Collin Anderson wrote: > Hi, > > Yes, this is possible. Something like: > > fro

Re: sending email

2015-01-21 Thread Collin Anderson
Hi, Yes, this is possible. Something like: from django.core.mail import send_mail def authorized_leave(request): form = MyForm() if request.method == 'POST': form = MyForm(request.POST) if form.is_valid(): obj = form.save() send_mail('Subject here'

Re: post_save signal not working in Django 1.7

2015-01-21 Thread Collin Anderson
Hi, Does the object in post_save have a pk/id? Are you using transactions? Collin On Monday, January 19, 2015 at 1:22:37 PM UTC-5, Luis Matoso wrote: > > Something similar is happening with me too: on a post_save of model it > isn't created yet on database, so several > error are raised by fu

Re: Flood of ''Invalid HTTP_HOST header" mails

2015-01-21 Thread Collin Anderson
Hi, So django is rejecting hosts even though they are listed in ALLOWED_HOSTS? Are you using apache/mod_wsgi by chance? It could be loading the settings for the wrong website. I assume you are reloading the server in between changes to the file. Collin On Monday, January 19, 2015 at 1:18:11 P

Re: Desperately need Django help!

2015-01-21 Thread Collin Anderson
Hi, A new CSRF token gets generated after you log in, so you'll need to ask django for the new one, or simply ready the new value from document.cookie. Collin On Monday, January 19, 2015 at 3:08:34 AM UTC-5, Neil Asnani wrote: > > Hi, I am trying to build a single page, restful application to t

Re: Canvas OAuth2 From Django View

2015-01-21 Thread Collin Anderson
Hi Henry, You need to send some kind of response back to the browser and the user. Maybe a message? or a maybe redirect to another page? def final_step(request): code = request.GET['code'] r = requests.post('https:///login/oauth2/token', { 'code': code, 'client_id': 'etc'} access_cod

makemigrations complains about a ForeignKey not being Unique

2015-01-21 Thread Samuel Jean
Hi there, Does anybody know of a way to trick Django 1.7 (or the proper way, if any) to modify the property of an inherited field so that it has unique property on the children only. Consider this abstract model : class UniqueObjectModel(models.Model): uuid = models.CharField(max_length=

Remote Authentication (out-of-the-box)

2015-01-21 Thread Cristian Bustos
Hello Friends, Here is my question, Remote Authentication (out-of-the-box) django I have 2 projects Django: 1. Users Api Django app (Django framework rest - token authentication) - Server 2. Django app (I need to authenticate users and consume APIs) - Client I can authenticate user,

Re: How to use password hasher snippet in Django?

2015-01-21 Thread Tom Lockhart
On Jan 21, 2015, at 3:07 PM, Supermario wrote:I am trying to move Druap 7 site to django 1.7 without invalidating user passwords, and this proved to be daunting.Fortunately, I have found this SO question and this hashing snippet but there is no documentation and as a newbie to

Re: Queryset .count() breaks when counting distinct values generated by .extra()

2015-01-21 Thread Collin Anderson
Hi, I don't use extra() a lot, but it could be that count() clears out extra. This doesn't exactly answer your question, but you may want to try your query on the 1.8 alpha using the new available expressions. You might be able to do this without needing extra() at all in 1.8. Collin On Sunda

How to use password hasher snippet in Django?

2015-01-21 Thread Supermario
I am trying to move Druap 7 site to django 1.7 without invalidating user passwords, and this proved to be daunting. Fortunately, I have found this SO question and this

Re: django.contrib.auth doesn't support template context processors?

2015-01-21 Thread Tom Evans
On Wed, Jan 21, 2015 at 2:31 PM, Mark Rogaski wrote: > Thanks, James. I think the call to TemplateResponse is fine, but the > context that's passed as a dict needs to be passed as a ContextRequest > instead. https://docs.djangoproject.com/en/1.7/ref/template-response/#django.template.response.Te

Re: export DJANGO_SETTINGS_MODULE

2015-01-21 Thread Bill Freeman
It looks like you are typing "*django-admin.py startproject WebSite*" at the python prompt, which is incorrect. You type it at the shell. If you get command not found, then instead type "python full/path/to/django-admin.py startproject WebSite". And in any case, the current directory must be the

Re: export DJANGO_SETTINGS_MODULE

2015-01-21 Thread th . granier
Hello i have sesinstalled django and re installed withdebian package when i lauch command django-admin.py startproject website here is what i get: *python3.4Python 3.4.2 (default, Dec 27 2014, 13:16:08) [GCC 4.9.2] on linuxType "help", "copyright", "credits" or "license" for more

Re: Re-Order rendering of input fields of django-contact-form?

2015-01-21 Thread Tobias Dacoir
Ah it works. After I restarted Django and hit F5 again it re-orders it now. So the code above is the solution. Thanks! -- 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 em

Re: Re-Order rendering of input fields of django-contact-form?

2015-01-21 Thread Tobias Dacoir
It still complained about the request, but I was finally able to get it to work using this code: def __init__(self, request, *args, **kwargs): super(CustomContactForm, self).__init__(request=request, *args, ** kwargs) fields_keyOrder = ['name', 'reason', 'email', 'body']

{% url ... %} does not work for callable?

2015-01-21 Thread Torsten Bronger
Hallöchen! I cannot get the following working: In urls.py: url(r"^samples/(?P.+)/edit/$", sample.edit), In the template: {% url 'samples.views.sample.edit' sample_name="whatever" %} I constantly get a NoReverseMatch, even if I pass the view function with its full path samples.views.sa

Re: Using jquery ajax POST method with django

2015-01-21 Thread carlos
if you comment middleware csrf this is a risk security problem in your app maybe you need read this part of documentation https://docs.djangoproject.com/en/1.7/ref/contrib/csrf/#ajax Cheers On Sat, Jan 17, 2015 at 10:44 PM, Hossein Rashnoo wrote: > I correct my code and it's worked. Thank you

Re: [ANNOUNCE] Django 1.8 alpha 1 released

2015-01-21 Thread carlos
Fabio yes i see https://docs.djangoproject.com/en/dev/releases/1.8/#management-commands - inspectdb now introspects database views on all database backends. In previous versions, only tables (not views)

Re: can't install the pillow library on my first attempt to add an ImageField to my model

2015-01-21 Thread aseds
thanks again... On Wednesday, January 21, 2015 at 8:59:30 AM UTC-8, Vijay Khemlani wrote: > > Since you are using the system-wide python installation you need to run > pip as superuser > > sudo pip install pillow > > You could also create a virtualenv instead of installing packages > system-wide

Re: can't install the pillow library on my first attempt to add an ImageField to my model

2015-01-21 Thread Vijay Khemlani
Since you are using the system-wide python installation you need to run pip as superuser sudo pip install pillow You could also create a virtualenv instead of installing packages system-wide, which is the recommended way of creating development environments. On Wed, Jan 21, 2015 at 1:53 PM, ased

Re: can't install the pillow library on my first attempt to add an ImageField to my model

2015-01-21 Thread aseds
thank you Vijay, the error has changed. now i've got error: could not create '/usr/local/lib/python2.7/dist-packages/PIL': Permission denied Cleaning up... Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_aseds/pillow/setu

Re: Re-Order rendering of input fields of django-contact-form?

2015-01-21 Thread Paul Royik
> > So pass the request > def __init__(self, request, *args, **kwargs): self.request=request super(CustomContactForm, self).__init__(*args, **kwargs) self.fields.keyOrder = ['name', 'reason', 'email', 'body'] -- You received this message because you are subscribed to

Re: Re-Order rendering of input fields of django-contact-form?

2015-01-21 Thread Tobias Dacoir
Unfortunately this doesn't work as the contact form needs to be passed the request as well. I tried to modify the call to super but it didn't work. As a workaround what I did now was to look at the HTML Code that the tag {{ form.as_p }} creates, and copy and paste that into the HTML template in

Re: Map Django Model to Legacy multi-join query

2015-01-21 Thread Scot Hacker
On Tuesday, January 20, 2015 at 8:02:57 AM UTC-8, Fred wrote: > > I've got a complex 1000+ table vendor read-only MS SqlServer database and > only have SELECT privileges. I can connect with pymssql no problem. > > Of all these tables, I probably care about 50 or less. > > I cannot create views un

Re: django.contrib.auth doesn't support template context processors?

2015-01-21 Thread Mark Rogaski
Thanks, James. I think the call to TemplateResponse is fine, but the context that's passed as a dict needs to be passed as a ContextRequest instead. Heck, this looks like a simple exercise to practice navigating the patch submission process. ;) On Tuesday, January 20, 2015 at 12:32:15 AM UTC-

Re: can't install the pillow library on my first attempt to add an ImageField to my model

2015-01-21 Thread Vijay Khemlani
You need to install the development python package for your distro For example, in Ubuntu sudo apt-get install python-dev in Fedora sudo yum install python-devel On Wed, Jan 21, 2015 at 10:44 AM, aseds wrote: > hi, > this is the first time i tried and added an ImageField to my model. then >

can't install the pillow library on my first attempt to add an ImageField to my model

2015-01-21 Thread aseds
hi, this is the first time i tried and added an ImageField to my model. then i did makemigrations ./manage.py makemigrations but it said that i should do: pip install pillow (the django documentation says it's a required library too...) doing so, it gave me some errors: ~/W/d/mysite> pip instal

export DJANGO_SETTINGS_MODULE

2015-01-21 Thread th . granier
Hello i have just installed django 1.7 on Debian jessie via synaptic when i start a console, import django is OK print(django.get_version()) ---> version 1.7.2 Now i try to launch the command "django-admin.py startproject WebSite" i get the error: *Traceback

Admin Portal Help (Django Tutorial)

2015-01-21 Thread Ed Volz
I've been following the Django tutorial and cannot get the Admin portal to work. Django is running via passenger in a shared environment on a virtual env with Python 2.7. The main page and admin portal load static resources (from static_url) just fine. Logging in with correct credentials yiel

Strange Behavior from the Django Admin (following tutorial on a shared server)

2015-01-21 Thread Ed Volz
Hi all, New to Django so I was following along with the tutorial and can get to the point of logging into the Administration portal (the main page works as well). Django is running with passenger in a virtualenv (python 2.7) on a shared host. I immediately receive a ERR_EMPTY_RESPONSE when

Re: block php requests

2015-01-21 Thread hinnack
Hi, thanks for your reply. Blocking all requests in Apache seems to be the best way. Can you give an example how to do that? As / is mapped to the wsgi app ( https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/modwsgi/ ) and a new files section does not the trick: #PHP p