Re: Force date and time formats to ISO

2014-09-29 Thread Mark Caglienzi
On 29 Sep 13:17, Collin Anderson wrote:
> If it helps, the ISO format should always at least be _accepted_ as an 
> input, even it it's not displayed that way.

Yes, I agree, but the main point (for what I need) is also the display of the
date and times.

This will allow to keep the webapp forms/tables uniform (it's a
requirement) and also ease the use of javascript widgets for the date
and time fields (one format, coherent).

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140929220337.GA17898%40sheldon.
For more options, visit https://groups.google.com/d/optout.


Problem with accents when filter

2014-09-29 Thread Neto
I want to filter results with and without accents, but Django can not do 
it. 

In my database has the word "áéíóú", but when I do: 

People.objects.filter (name__icontains = 'aeiou') 


Returns nothing. Django how to return the result with and without accent? 
(I am using PostgreSQL and Django 1.7)

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/04f1e13c-c685-49fd-be28-260e01f72745%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with populate script

2014-09-29 Thread Collin Anderson
Is the path to the django source code is on your PYTHONPATH?

If it's in the same directory, try: PYTHONPATH=. populate.py

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1fc0a056-e6c4-4653-b0bc-6fb8e8df8e42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Force date and time formats to ISO

2014-09-29 Thread Collin Anderson
If it helps, the ISO format should always at least be _accepted_ as an 
input, even it it's not displayed that way.

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/db9cd636-ae7c-44a9-ad21-88820240671e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need example to implement sql (dictionary) translations

2014-09-29 Thread Collin Anderson
does list(your_raw_query) return what you want?

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/73a57179-67c6-4bdf-9222-b35d7b605582%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Registration

2014-09-29 Thread Collin Anderson
def get_success_url(request, user):
return settings.REGISTRATION_EMAIL_REGISTER_SUCCESS_URL


or even more straighforward:
def get_success_url(request, user):
return '/accounts/register/complete/'

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/87b7378e-5979-4acb-b4ff-6537c3eee957%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django : Problem with forms

2014-09-29 Thread Collin Anderson
Very interesting. Your code looks correct. Did you restart uwsgi? Does 
clearing out your .pyc files fix it?

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b4a5d5eb-851d-4d69-902e-fe7e4434be7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AppRegistryNotReady error running fastcgi on IIS

2014-09-29 Thread Shawn H
I was, but it turns out that wasn't the issue. I asked the question on the 
pytools site (here ), thinking 
it was possible an issue with wfastcgi. It turns out it's not an issue with 
wfastcgi. It's that At 1.6, the recommended handler was 

django.core.handlers.wsgi.WSGIHandler()

At 1.7, it seems the correct handler is now

django.core.wsgi.get_wsgi_application()

which calls django.setup() directly.

As soon as I replaced my handler in my web.config file, the issue 
disappeared. As you can see at the issue on the pytools site, there is 
still plenty of confusion as to the proper way to use wfastcgi in a pure 
wsgi application, but at least I can run my application. Thanks.


On Monday, September 29, 2014 2:38:38 PM UTC-5, Collin Anderson wrote:
>
> Are you sure you're calling django.setup() before the first request 
> happens?
>
> From what I can tell, an error happens while processing a request, and 
> then this error happens while trying to generate a pretty error message.
>

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1c6b650c-ba17-4aba-89cf-8a085a3d97b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Change GFK to FK

2014-09-29 Thread carlos
Hi, ok my questions is how to create a data migration, populating the FK
data??.
 my old data no have fk only content_type and object_id for my relations
with
my class ModelMain,
 if fk = object_id?? or content_type?

thank

On Mon, Sep 29, 2014 at 6:23 AM, Tom Christie 
wrote:

> You'll probably want to take this approach:
>
> * Create a schema migration, adding the FK.
> * Create a data migration, populating the FK data.
> * Create a schema migration, removing the GFK.
>
> On Sunday, 28 September 2014 23:15:22 UTC+1, sacrac wrote:
>>
>> Hi, is posible to change GenericForeingnKey to ForeignKey without losing
>> data?
>>
>> any link to explain the trick?
>>
>> I have an old application with GFK but now I want to FK moment but I will
>> not lose data
>>
>> this is example my models old and below the new models
>>
>> http://pastebin.com/ym6Scrmd
>>
>> Cheers
>>
>  --
> 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...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3730a43f-b926-48d4-be5f-5bcfa2914220%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAM-7rO0Dd3F_NUwHmEMy1QYJjwCjsAqG8dWd7jNNA-zHwJzJ-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: arrange date-products data on admin

2014-09-29 Thread Collin Anderson
Django doesn't have a way to group items like that in the admin. Though, 
checkout out date_hierarchy if you haven't seen it.

https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.date_hierarchy

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/78ca6b90-ac26-432d-8764-82fe903548c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: at django login my request.POST.get data are all empty, I struggle with what I missed there

2014-09-29 Thread Collin Anderson
Use a login view like this:
@sensitive_post_parameters('password')
def login_view(request):
form = LoginForm(initial={'email': request.order.email})
if request.POST.get('login'):
form = LoginForm(data=request.POST)
if form.is_valid():
if user.is_active:
auth.login(request, form.user)
return redirect('public:courselist')
else:
messages.error(request, "Ihr Account wurde deaktiviert. 
Bitte nehmen Sie Kontakt zu uns auf, wenn Sie Ihnen wieder aktivieren 
wollen.")
return redirect('userauth:login')
return render(request, 'userauth/login.html', {'form': form})


and add a clean() method to your form like this:
def clean(self):
if self.cleaned_data.get('username') and self.cleaned_data.get(
'password'):
self.user = authenticate(username=self.cleaned_data['username'], 
password=self.cleaned_data['password'])
if self.user is None:
raise forms.ValidationError('Please enter a correct 
username and password.')
elif not self.user.is_active:  # or leave this out and handle 
inactive case in your view above.
raise forms.ValidationError('This account is inactive.')
return self.cleaned_data


-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f08c1fcc-b506-41fd-b8cb-2e6ac662257e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Open Django template in dialog box (not in window)

2014-09-29 Thread Collin Anderson
I have a jsfiddle working with my code. http://jsfiddle.net/mafos5ox/1/

Do any errors show up in the developer tools console?

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4030c2ed-0495-4525-9b1f-3376dd709263%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AppRegistryNotReady error running fastcgi on IIS

2014-09-29 Thread Collin Anderson
Are you sure you're calling django.setup() before the first request happens?

>From what I can tell, an error happens while processing a request, and then 
this error happens while trying to generate a pretty error message.

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7befbea2-175b-42f8-8043-cc6783b21fad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Suggestions on autocomplete solutions for non-model forms not in the admin

2014-09-29 Thread Collin Anderson
It might be simplest to write all your own code. It could be easier to 
debug and you'll have full control of the situation.

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b3b097a8-54a7-44a5-bea2-14c60801f1c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with populate script

2014-09-29 Thread robert brook
This was really not a core function of the application, so I wold not worry 
about it.

Just add the data to a csv page and import it into sql lite to get you 
going.


But I believe that you need to tell Python where the data base is located 
using the settings file

 import os
 os.environ['DJANGO_SETTINGS_MODULE']='settings'



On Monday, September 29, 2014 1:51:13 PM UTC-4, Daniel Grace wrote:
>
> I am trying to follow the tutorial at http://www.tangowithdjango.com/
> I am stuck in section 5.8 where it shows how to create a script to 
> populate the database.
> I created a script called "populate.py" as shown (except I added brackets 
> for the Python 3 print statements),
> and saved it in the root directory for my project.
> But when I run the script I get an error:
>
> (landy) C:\landy\tango>populate.py
> Starting Rango population script...
> Traceback (most recent call last):
>   File "C:\landy\tango\populate.py", line 59, in 
> from rango.models import Category, Page
>   File "C:\landy\tango\rango\models.py", line 1, in 
> from django.db import models
> ImportError: No module named 'django.db'
>
> I tried placing the script in C:\landy\tango\tango and 
> C:\landy\tango\rango directories but I get similar errors.
>
> Is it a better approach to make the populate script into a manage command?
> Or should I be using fixtures?
>
> 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 email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e1dfa25b-8c7c-4489-88d4-eaa637ca94b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Problem with populate script

2014-09-29 Thread Daniel Grace
I am trying to follow the tutorial at http://www.tangowithdjango.com/
I am stuck in section 5.8 where it shows how to create a script to populate 
the database.
I created a script called "populate.py" as shown (except I added brackets 
for the Python 3 print statements),
and saved it in the root directory for my project.
But when I run the script I get an error:

(landy) C:\landy\tango>populate.py
Starting Rango population script...
Traceback (most recent call last):
  File "C:\landy\tango\populate.py", line 59, in 
from rango.models import Category, Page
  File "C:\landy\tango\rango\models.py", line 1, in 
from django.db import models
ImportError: No module named 'django.db'

I tried placing the script in C:\landy\tango\tango and C:\landy\tango\rango 
directories but I get similar errors.

Is it a better approach to make the populate script into a manage command?
Or should I be using fixtures?

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 email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a05392f4-bf88-403d-98da-8478595be570%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Force date and time formats to ISO

2014-09-29 Thread Mark Caglienzi
Hello to the list,
I am developing a Django website that needs USE_L10N = True, and
per-user TZ settings, but I want to force the output of dates and times
to ISO everywhere, once and for all (-MM-DD and HH:MM:SS).

I understand that Django with USE_L10N = True overrides the output of
DateField, DateTimeField, TimeField to follow the locale format, but I
need the format of my choice everywhere.

For the output in templates I came to this solution: write a
templatefilter that does the localtime -> strftime steps, and it works.

But to be the definitive solution also form fields when doing CRUD on my
database objects must accept and show dates and datetimes in that format.

I'm thinking that I have to write custom form fields like
ISO_DateField(django.forms.DateField),
ISO_DateTimeField(django.forms.DateTimeField) and
ISO_TimeField(django.forms.TimeField) overriding their methods to do
what I need.

Is there a better way?

Thanks in advance,
Mark

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/542951AE.9040406%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Need example to implement sql (dictionary) translations

2014-09-29 Thread robert brook
>From the django project web site, I am trying to implement the following 
code and have it spit out the dictionary form of the sql.

Does anyone have an example of how this is done.

The code below is from the project web page

https://docs.djangoproject.com/en/1.7/topics/db/sql/


When I execute the 2 lines below I retrieve the following


Does anyone have an example so that  I can get this into a dictionary 
format so that I can send it back to the web page for consumption?

>>> name_map = {'first': 'first_name', 'last': 'last_name', 'bd': 'birth_date', 
>>> 'pk': 'id'}>>> Person.objects.raw('SELECT * FROM some_other_table', 
>>> translations=name_map)


-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/90ee80be-2413-4b6a-8739-2bd73a1d15b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: templates: if and static tags incompatible?

2014-09-29 Thread Fred Stluka

The problem is that static is not being recognized as a valid Django
tag.  Add this line to the top of the template file to define it.

{% load staticfiles %}

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/29/14 12:41 PM, chansonsyiddish wrote:

Hello,

I've got a small problem:

here is the code in my template:

{% if p.fleches %}


{% endif %}

and the django development server tells me:

Django Version: 1.4.5
Exception Type: TemplateSyntaxError
Exception Value:
Invalid block tag: 'static', expected 'elif', 'else' or 'endif'


Is it a bug, or is it really impossible to put a static tag inside an 
if tag?


Thanks in advance!


--
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...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54298BAD.6030606%40gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54298F84.40103%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


templates: if and static tags incompatible?

2014-09-29 Thread chansonsyiddish

Hello,

I've got a small problem:

here is the code in my template:

{% if p.fleches %}
%}" >

{% endif %}

and the django development server tells me:

Django Version: 1.4.5
Exception Type: TemplateSyntaxError
Exception Value:

Invalid block tag: 'static', expected 'elif', 'else' or 'endif'


Is it a bug, or is it really impossible to put a static tag inside an if 
tag?


Thanks in advance!


--
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54298BAD.6030606%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Config: DB or git?

2014-09-29 Thread Erik Cederstrand
Den 29/09/2014 kl. 16.11 skrev Derek :
> 
> So is it possible to store encrypted database passwords in the Django 
> settings (or local_settings) file? 

Yes. A simple solution would be to use a symmetric encryption like simple-crypt 
to encrypt and decrypt your passwords using a key that you provide externally. 
Here's a quick example:

import simplecrypt

SECRET_KEY = 'my_secret_key' # Get this from a file, enter it manually or by 
other sufficiently secure means

# Example code to generate the encrypred password
my_password = 'super_secret'
my_encrypted_password = simplecrypt.encrypt(SECRET_KEY, text)

# This is what you put in settings.py
my_encrypted_password = 'KLJJ543#EURO%'
my_password = simplecrypt.decrypt(SECRET_KEY, my_encrypted_password)


Erik

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/530E0223-7AC1-411C-ADA0-34F581B6ED1E%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Config: DB or git?

2014-09-29 Thread Daniel Rus Morales
On 29 Sep 2014, at 17:13, Javier Guerra Giraldez  wrote:

> On Mon, Sep 29, 2014 at 8:15 AM, Alejandro Varas G.
>  wrote:
>>> But where does configuration belong?
>> 
>> "To the environment"
> 
> 
> this is the currently fashionable answer, but I haven't seen any
> justification for it.  Unfortunately, the 12factors manifesto tells
> the how, but very little of the why.
> 
> In my experience, environment variables are clumsy, fragile and a pain
> to work with.
> 
> I guess a more balanced option would be to store somewhere else,
> probably the database (although i'm not too opposed to VCS) with the
> host-variable parts (or everything, who cares about a couple KB extra
> storage?) as a set indexed by hostname, which is read from the
> environment.


I see configurable settings, like those in the settings module, as code 
settings, and those you would put in the DB as user customizable settings. The 
former are meant to be changed by developers and sys admins, and the latter by 
website users. In my opinion settings module changes are mostly related to 
staging or performance rather than user oriented. Apart from there are a number 
of interesting Django apps in Djangopackages [1] that allow you to put your 
settings in the DB.

[1] -> https://www.djangopackages.com/grids/g/configuration/

Regards


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Config: DB or git?

2014-09-29 Thread Javier Guerra Giraldez
On Mon, Sep 29, 2014 at 8:15 AM, Alejandro Varas G.
 wrote:
>> But where does configuration belong?
>
> "To the environment"


this is the currently fashionable answer, but I haven't seen any
justification for it.  Unfortunately, the 12factors manifesto tells
the how, but very little of the why.

In my experience, environment variables are clumsy, fragile and a pain
to work with.

I guess a more balanced option would be to store somewhere else,
probably the database (although i'm not too opposed to VCS) with the
host-variable parts (or everything, who cares about a couple KB extra
storage?) as a set indexed by hostname, which is read from the
environment.

-- 
Javier

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoS6LJXMwha5CO5MBm4NvUr8OUOOnTxX3dkSXwBNNjL%3DaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Registration

2014-09-29 Thread Tsolmon Narantsogt
Hello folks

*I got this error Django Registration 'str' object is not callable*

INSTALLED_APPS = (
 ..
'registration',
)

REGISTRATION_EMAIL_REGISTER_SUCCESS_URL = '/accounts/register/complete/'

in urls.py

get_success_url=getattr(
settings, 'REGISTRATION_EMAIL_REGISTER_SUCCESS_URL',
lambda request, user: '/'
),

Please help what happend to me i dont understand.

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPs6WScaQqikbxyNALZ5c4%3D-dYN_s%2Bpt6Y-kD9UBhzJgVgA97w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Config: DB or git?

2014-09-29 Thread Derek
On Monday, 29 September 2014 15:41:23 UTC+2, Erik Cederstrand wrote:
>
> Den 29/09/2014 kl. 15.04 skrev Thomas Güttler  >: 
>
> > Hi, 
> > 
> > of course we separate data from code: 
> > 
> > - code belongs into version control (git) 
> > - data belongs into a database (postgres) 
> > 
> > But where does configuration belong? 
>
> Strictly speaking, configuration belongs in a configuration management 
> system - Ansible, Chef and Puppet being just examples. The words option, 
> setting, preference and configuration are often used interchangeably, but 
> if you define "configuration" as "something that is loaded by the program 
> on startup" and which is not universal for all installations, then you must 
> store configuration independently from the VCS and DB. 
>
> Depending on your hosting environment, you could store your host-specific 
> configuration in a versioned Fabric script. But keep in mind that storing 
> cleartext passwords is bad practice, be it in a database or in Git. 
>
> Erik


So is it possible to store encrypted database passwords in the Django 
settings (or local_settings) file? 

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6c146197-70be-46f8-a7e0-b184f7ac2ff6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Config: DB or git?

2014-09-29 Thread Erik Cederstrand
Den 29/09/2014 kl. 15.04 skrev Thomas Güttler :

> Hi,
> 
> of course we separate data from code:
> 
> - code belongs into version control (git)
> - data belongs into a database (postgres)
> 
> But where does configuration belong?

Strictly speaking, configuration belongs in a configuration management system - 
Ansible, Chef and Puppet being just examples. The words option, setting, 
preference and configuration are often used interchangeably, but if you define 
"configuration" as "something that is loaded by the program on startup" and 
which is not universal for all installations, then you must store configuration 
independently from the VCS and DB.

Depending on your hosting environment, you could store your host-specific 
configuration in a versioned Fabric script. But keep in mind that storing 
cleartext passwords is bad practice, be it in a database or in Git.

Erik

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20E05163-569C-42EE-BA19-4C47E1E02162%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Newbie Question: Django Tutorial Part 4 - Exception Issue

2014-09-29 Thread Daniel Rus Morales
No, that’s not the cause, the lack of it would be. That line shows the content 
of ‘error_message' when it does exist and has a value other than None. But if 
you have it in your template the error must be somewhere else in your code. 
Must be a simple syntax mistake you didn’t notice, either in the template file 
or in the vote view.

To be sure that your code is raising an exception you can place a print 
statement right after the except, before the call to render. Replace the call 
to render with these lines, they do the same but also print a message in the 
console:

except (KeyError, Choice.DoesNotExist):
# redisplay the question voting form
context = {
'question': p,
'error_message': "You didn't select a choice.",
}
print("context: ", context)
return render(request, 'polls/detail.html', context)


Click vote again and see what’s the output when you click on “Vote” without 
selecting any choice. The text of the print statement will show up in the 
console where you launched `python manage.py runserver`.

If you see the output “context: “ and the ‘error_message’ string with the 
actual message, then you have a syntax mistake in your template. Otherwise it’s 
in your view.

Cheers


On 29 Sep 2014, at 14:55, zaiks0105  wrote:

> I do. Is that line causing the behavior?
> 
> 
> 
> On Monday, September 29, 2014 7:15:47 AM UTC-4, Daniel Rus Morales wrote:
> Hi Zaiks0105,
> 
> Do you have the following line in "your polls/templates/polls/detail.html”?
> 
> {% if error_message %}{{ error_message }}{% endif %}
> 
> On 29 Sep 2014, at 12:48, zaiks0105  wrote:
> 
>> Hi,
>> 
>> I am following Django official tutorial and have unanswered issue at part 4, 
>> https://docs.djangoproject.com/en/1.7/intro/tutorial04/. Here is the 
>> exception handling code,
>> 
>> except (KeyError, Choice.DoesNotExist):
>> # Redisplay the question voting form.
>> return render(request, 'polls/detail.html', {
>> 'question': p,
>> 'error_message': "You didn't select a choice.",
>> })
>> 
>> When I run the server and click on [Vote] without selecting a choice, the 
>> page does NOT show me the error message. The same voting page comes back as 
>> if [Vote] was not clicked.
>> I checked my lines and everything seems identical per tutorial.
>> 
>> Any help appreciated!
>> 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 
>> email to django-users...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/69aaa1bb-5371-4aec-ae1f-fb44880e46b3%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> 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...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/2adefa94-7801-48ad-af1f-1d5ec10ada86%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Config: DB or git?

2014-09-29 Thread Alejandro Varas G.
Hi Thomas,

El 29/09/2014 10:05, "Thomas Güttler"  escribió:
>
> Hi,
>
> of course we separate data from code:
>
>  - code belongs into version control (git)
>  - data belongs into a database (postgres)
>
> But where does configuration belong?

"To the environment"

A good practice is to place config in the environment[0] and load it from
code.

0 - http://12factor.net/config

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL60nj%2BUufKOYvJPvUd%2Bu8ivJbTLc04S7JEyH-KaXhi-0nkD2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Config: DB or git?

2014-09-29 Thread Thomas Güttler

Hi,

of course we separate data from code:

 - code belongs into version control (git)
 - data belongs into a database (postgres)

But where does configuration belong?

Since I am a developer I like version control.

But the longer I think about this question, I think
the perfect configuration for an app just contains
one entry: How to connect to the DB.

Sooner or later you want things to editable via an admin interface.

And if you look at big systems like SAP. There is only very little config in 
files.

I think config should be done in the database, not files. It is hard to accept
this, since version control is great for files, and not so good for databases,
but I think it is the way to go.

What do you think?

  Thomas



--
Thomas Güttler
http://thomas-guettler.de/

--
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/542958FB.5010800%40tbz-pariv.de.
For more options, visit https://groups.google.com/d/optout.


Re: Newbie Question: Django Tutorial Part 4 - Exception Issue

2014-09-29 Thread zaiks0105
I do. Is that line causing the behavior?



On Monday, September 29, 2014 7:15:47 AM UTC-4, Daniel Rus Morales wrote:
>
> Hi Zaiks0105,
>
> Do you have the following line in "your polls/templates/polls/detail.html”?
>
> {% if error_message %}{{ error_message }}{% endif %}
>
>
> On 29 Sep 2014, at 12:48, zaiks0105  
> wrote:
>
> Hi,
>
> I am following Django official tutorial and have unanswered issue at part 
> 4, https://docs.djangoproject.com/en/1.7/intro/tutorial04/. Here is the 
> exception handling code,
>
> except (KeyError, Choice.DoesNotExist):
> # Redisplay the question voting form.
> return render(request, 'polls/detail.html', {
> 'question': p,
> 'error_message': "You didn't select a choice.",
> })
>
> When I run the server and click on [Vote] without selecting a choice, the 
> page does NOT show me the error message. The same voting page comes back as 
> if [Vote] was not clicked.
> I checked my lines and everything seems identical per tutorial.
>
> Any help appreciated!
> 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 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/69aaa1bb-5371-4aec-ae1f-fb44880e46b3%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2adefa94-7801-48ad-af1f-1d5ec10ada86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Change GFK to FK

2014-09-29 Thread Tom Christie
You'll probably want to take this approach:

* Create a schema migration, adding the FK.
* Create a data migration, populating the FK data.
* Create a schema migration, removing the GFK.

On Sunday, 28 September 2014 23:15:22 UTC+1, sacrac wrote:
>
> Hi, is posible to change GenericForeingnKey to ForeignKey without losing 
> data?
>
> any link to explain the trick?
>
> I have an old application with GFK but now I want to FK moment but I will 
> not lose data
>
> this is example my models old and below the new models
>
> http://pastebin.com/ym6Scrmd
>
> Cheers
>

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3730a43f-b926-48d4-be5f-5bcfa2914220%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Newbie Question: Django Tutorial Part 4 - Exception Issue

2014-09-29 Thread Daniel Rus Morales
Hi Zaiks0105,

Do you have the following line in "your polls/templates/polls/detail.html”?

{% if error_message %}{{ error_message }}{% endif %}

On 29 Sep 2014, at 12:48, zaiks0105  wrote:

> Hi,
> 
> I am following Django official tutorial and have unanswered issue at part 4, 
> https://docs.djangoproject.com/en/1.7/intro/tutorial04/. Here is the 
> exception handling code,
> 
> except (KeyError, Choice.DoesNotExist):
> # Redisplay the question voting form.
> return render(request, 'polls/detail.html', {
> 'question': p,
> 'error_message': "You didn't select a choice.",
> })
> 
> When I run the server and click on [Vote] without selecting a choice, the 
> page does NOT show me the error message. The same voting page comes back as 
> if [Vote] was not clicked.
> I checked my lines and everything seems identical per tutorial.
> 
> Any help appreciated!
> 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 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/69aaa1bb-5371-4aec-ae1f-fb44880e46b3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Looking for feedback on this Django news aggregation feed

2014-09-29 Thread kvnflm
I'm working on a prototype for a website that aggregates articles from 
various blogs around the web and tags them by the terms that are mentioned, 
so you can create a customized feed with articles related to topics you're 
interested in. If you'd like to check it out, you can see the Django feed 
here:

http://hakken.ubicast.com/feed/django

If anyone has any feedback on what features you like, don't like, or would 
like to have, as well as any sources on Django usage/development that 
aren't already present, that would be great to know.

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 email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/38322fac-1919-433d-9abb-aed59e09f0ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Newbie Question: Django Tutorial Part 4 - Exception Issue

2014-09-29 Thread zaiks0105
Hi,

I am following Django official tutorial and have unanswered issue at part 
4, https://docs.djangoproject.com/en/1.7/intro/tutorial04/. Here is the 
exception handling code,

except (KeyError, Choice.DoesNotExist):
# Redisplay the question voting form.
return render(request, 'polls/detail.html', {
'question': p,
'error_message': "You didn't select a choice.",
})

When I run the server and click on [Vote] without selecting a choice, the page 
does NOT show me the error message. The same voting page comes back as if 
[Vote] was not clicked.
I checked my lines and everything seems identical per tutorial.

Any help appreciated!
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 email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/69aaa1bb-5371-4aec-ae1f-fb44880e46b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.