not thread-safe function can break a django application?

2014-11-22 Thread Fabio C. Barrionuevo da Luz
I was trying to answer a question in a Brazilian forum about django.

one of the proposed solutions utilized the function locale.setlocale() from
locale module.

according to the documentation[1] locale.setlocale() function is not
thread-safe

the question is:

not thread-safe function can break a django application?
If so, how?
Which scenario I would have problems?
some easily reproducible example of problems using not thread-safe function?


[1] https://docs.python.org/2/library/locale.html#locale.setlocale

--
Fábio C. Barrionuevo da Luz
Acadêmico de Sistemas de Informação na Faculdade Católica do Tocantins -
FACTO
Palmas - Tocantins - Brasil - América do Sul

http://pythonclub.com.br/

Blog colaborativo sobre Python e tecnologias Relacionadas, mantido
totalmente no https://github.com/pythonclub/pythonclub.github.io .

Todos são livres para publicar. É só fazer fork, escrever sua postagem e
mandar o pull-request. Leia mais sobre como publicar em README.md e
contributing.md.
Regra básica de postagem:
"Você" acha interessante? É útil para "você"? Pode ser utilizado com Python
ou é útil para quem usa Python? Está esperando o que? Publica logo, que
estou louco para ler...

-- 
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/CAPVjvMaDcpZ0YE-v4tLwcRk6CJMDXVrt53fFMYfCN01NgyG94A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it wrong to disable a lot of the core django features?

2014-11-22 Thread Gabriel - Iulian Dumbrava
Hello!

I would suggest to not drop the use of the built in auth module. You have 
many template and view tags, decorators, etc which are very helpful.

You may, for example create a group for each company/branch then add each 
user to their respective groups upon registration.

Each groups may have custom permissions, so you are not stuck with the 
built in add/edit/delete rights. You may create any type of permission and 
check for it in verious places.

vineri, 21 noiembrie 2014, 22:18:27 UTC+2, John Rodkey a scris:
>
> We are evaluating django for a new internal CRM project and have issues 
> using many of the built in features including: the base user, permissions, 
> and authentication.
>
> We do not wish to use the built-in admin...  The level of complexity for 
> our permissions will be based on the employees job function/role.  While 
> django does offer "Groups" under permissions, we have many subsidiaries 
> which may name their own groups, this is our reasoning for dumping the 
> built-in permissions.
>
> What we are trying to accomplish -
>
> 1. User registration and authorization based on users email address. (We 
> believe this could be created with the "Custom User" information found in 
> the docs.)
>
> 2. Depending on the users email domain (the subsidiary) they work for, 
> they will only have access to that data (We do not believe django offers 
> this, and will be building it)
>
> 3. Each company (subsidiary) will have their own permission roles/groups 
> (We do not believe this is available in django, please correct if wrong).
>
> 4. Each user will be assigned role(s)/permission(s) for their company (We 
> believe this will need to be a custom tool)
>
>
> Is there a simple solution to altering the built-in authentication and 
> permission to fit our needs?  
>
>
>

-- 
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/e2ead593-ff77-4f20-8e3a-d373cfdf1e88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: please help: problem saving strings to the database

2014-11-22 Thread Sabine Maennel
Thank you Tiago, you got it. It was the Comma. So grateful to you. I 
searched for hours and did not catch this simple reason, that resulted form 
my copy and paste!

Am Freitag, 21. November 2014 15:02:20 UTC+1 schrieb Tiago Almeida:
>
> Check if you have a comma after the string.
>
>  log = ClassroomLog.objects.get(...)
> log.text = "Hallo"*,*
> log.save()
>
> Sexta-feira, 21 de Novembro de 2014 11:57:40 UTC, Sabine Maennel escreveu:
>>
>> Hello,
>>
>> I do not know why this is happening: If I try to update a database record 
>> the text gets into the field the wrong way:
>>
>> models.py
>>
>> from model_utils.models import TimeStampedModel
>>
>> class ClassroomLog(TimeStampedModel):
>> ...
>> text = models.TextField()
>>
>> then somewhere else I put data in that database like that:
>>
>> ...
>> log = ClassroomLog.objects.get(...)
>> log.text = "Hallo"
>> log.save()
>>
>> then the field in the database will contain this:
>>
>> ('Hallo',) 
>>
>> What am I doing wrong here?
>>
>> If I do this instead: 
>>
>> ...
>> log = ClassroomLog.objects.get(...)
>> log.delete()
>> log = ClassroomLog(..., text = "Hallo", ...)
>> log.save()
>>
>> it works out as expected and the admin of the database shows for 
>> list_display = ('text',): 
>>
>> Hallo  
>>
>> Can someone please help me with this. I tried for quite a while, but 
>> could not figure out what is happening.
>>
>>  with kind regards and thanks in advance
>>  Sabine
>>
>>

-- 
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/9e3331a5-1278-4b6d-bafb-e2fee77c0dfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: please help: problem saving strings to the database

2014-11-22 Thread Sabine Maennel
Thank you Szymon, Tiago just got it: I had a misplaced comma that caused 
the error.

Am Freitag, 21. November 2014 19:21:51 UTC+1 schrieb Szymon Krzemiński:
>
> Looks like the record is stored as a one-element tuple. Don't know what's 
> the source of this behaviour yet, though.
>
> W dniu piątek, 21 listopada 2014 12:57:40 UTC+1 użytkownik Sabine Maennel 
> napisał:
>>
>> Hello,
>>
>> I do not know why this is happening: If I try to update a database record 
>> the text gets into the field the wrong way:
>>
>> models.py
>>
>> from model_utils.models import TimeStampedModel
>>
>> class ClassroomLog(TimeStampedModel):
>> ...
>> text = models.TextField()
>>
>> then somewhere else I put data in that database like that:
>>
>> ...
>> log = ClassroomLog.objects.get(...)
>> log.text = "Hallo"
>> log.save()
>>
>> then the field in the database will contain this:
>>
>> ('Hallo',) 
>>
>> What am I doing wrong here?
>>
>> If I do this instead: 
>>
>> ...
>> log = ClassroomLog.objects.get(...)
>> log.delete()
>> log = ClassroomLog(..., text = "Hallo", ...)
>> log.save()
>>
>> it works out as expected and the admin of the database shows for 
>> list_display = ('text',): 
>>
>> Hallo  
>>
>> Can someone please help me with this. I tried for quite a while, but 
>> could not figure out what is happening.
>>
>>  with kind regards and thanks in advance
>>  Sabine
>>
>>

-- 
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/84a6c97f-ce7b-4061-9473-e8e6f4606ce8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


is it worth going for version 1.6 for commertial project

2014-11-22 Thread Krishnakant Mane

Hello all,
I have been looking for some good discussion on this issue.
i see there is not much difference between 1.7 and 1.6 as far as my 
requirement goes.
I have gone through the official docs for both in a kind of rappid 
specific way.

As it is I am not going to use ORM at all.
I am mainly intrested in views which will talk to an already existing 
core logic written as an xmlrpc server.

The code is stable and works excelent on commertial projects.
My main interest is to just build the web front end (I would be using 
views and templates ) for the said project.

I like the templating system and the forms are handled very well.
I would be further interested in the way Django helps write css or 
integrate javascript libraries like Bootstrap using Python code itself.
So I don't see any great difference in 1.6 vs 1.7, provided I have not 
missed some thing.
The question is now, given that support for 1.6 could be over soon, is 
it worth while to stick with it?
on the other hand, 1.7 will also loose out support some tiem or the 
other, although later as compared to version 1.6?  Again, 1.6 I guess 
will receive updates at least for a year if I am not mistaken?


I use Python 2.7 so no problems on that department.
Kindly let me know your views so that I can take  a decision at the earlist.
happy hacking.
Krishnakant.
Are theredevelopers on this list who still vouch by 1.6 and would 
recommend me to go with that version?


--
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/5470873A.3060401%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


django on ubuntu

2014-11-22 Thread Mosharof sabu
 hi 
  i a going to start django on ubuntu . can any one please give me some 
link of good tutorial of django on ubuntu (from installation to 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/3f049723-779d-438e-907a-d2a921db7d14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Image input missing from POST request

2014-11-22 Thread Abhishek Batra
Hi,

This is probably not a Django issue, but just trying my luck.

I have an input field corresponding to a Django ImageField in a Django 
template. Rendered, the HTML looks like:


... (other input fields and elements)

The corresponding View is an UpdateView. I found request.FILES to be empty 
and request.cleaned_data to contain 'profile_pic': None.

I used firebug to track the POST data. It contained other fields but not 
profile_pic.

Can anyone say why the file does not get uploaded? I've posted this 
question to StakOverflow 

 as 
well, in case someone wants reputation points.

Thanks,
Abhishek Batra

-- 
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/8cca9543-a913-4499-817b-efe059b27f9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Image input missing from POST request

2014-11-22 Thread donarb
On Friday, November 21, 2014 7:56:54 PM UTC-8, Abhishek Batra wrote:
>
> Hi,
>
> This is probably not a Django issue, but just trying my luck.
>
> I have an input field corresponding to a Django ImageField in a Django 
> template. Rendered, the HTML looks like:
>
>method="post" 
>   id="profile_form"
>   enctype="multipart/form-data">
> ... (other input fields and elements) id="id_profile_pic" name="profile_pic" type="file" />
>
> The corresponding View is an UpdateView. I found request.FILES to be 
> empty and request.cleaned_data to contain 'profile_pic': None.
>
> I used firebug to track the POST data. It contained other fields but not 
> profile_pic.
>
> Can anyone say why the file does not get uploaded? I've posted this 
> question to StakOverflow 
> 
>  as 
> well, in case someone wants reputation points.
>
> Thanks,
> Abhishek Batra
>


The input field is outside the closing  tag so would not be uploaded 
as part of the form. 

-- 
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/a9f69f16-861c-4a47-bd7f-6c52576ed739%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: DecimalField returns 'This value must be a decimal number' when blank

2014-11-22 Thread elcaiaimar
Hi Collin

I'm using postgresql db, I' ve attached my views, forms and models. I' ve 
thought to do the ModelForm when I solve this problem, thanks for your 
advice!

Thank you very much!


El domingo, 16 de noviembre de 2014 18:51:43 UTC+1, elcaiaimar escribió:
>
> Hello everybody, I've a problem with DecimalField at Forms. I've a long 
> form in my template and I want to left some fields in blank. I've declared 
> these fields with 
> *required=False*, but when I submit the form I receive this error: '*This 
> value must be a decimal number*'.
>
> I've tried to declare *blank=True, null=True* in respective fields in 
> models.py and make a syncdb but it continues without works
>
> Does somebody know how could I solve this problem?
>
> Thank you very much!
>

-- 
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/df6fd584-e398-4d48-bbcd-23c96518f8ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
# _*_ encoging: utf-8 _*_
from django import forms

class CuencasForm(forms.Form):
	descripcion_cuenca = forms.CharField()

class ColectoresForm(forms.Form):
	referencia = forms.CharField()

TIPO_POZO = (
	('', ''),
('INDETERMINADO', 'Indeterminado'),
('CONTINUACION', 'Continuacion'),
('CONEXION SIN POZO', 'Conexion sin pozo'),
('ENTRONQUE', 'Entronque'),
('CABECERA', 'Cabecera'),
('PARTIDOR', 'Partidor'),
('TRANSICION', 'Transicion'),
('VERTIDO', 'Vertido'),
('VIRTUAL', 'Virtual'),
('JPL', 'JPL'),
('PRESA HINCHABLE', 'Presa hinchable'),
('AZUD', 'Azud'),
)

MATERIAL_POZOS = (
	('', ''),
('INDETERMINADO', 'Indeterminado'),
('HORMIGON', 'Hormigon'),
('MIXTO', 'Mixto'),
('OBRA DE FABRICA', 'Obra de fabrica'),
('PIEDRA', 'Piedra'),
('PREFABRICADO', 'Prefabricado'),
)

MATERIAL_PATES = (
	('', ''),
('INDETERMINADO', 'Indeterminado'),
('METALICOS', 'Metalicos'),
('NO EXISTEN', 'No existen'),
('POLIPROPILENO', 'Polipropileno'),
)

class PozosForm(forms.Form):
	codpozo = forms.CharField(max_length=20)
	coorx = forms.DecimalField(max_digits=13, decimal_places=5)
	coory = forms.DecimalField(max_digits=13, decimal_places=5)
	tipo = forms.ChoiceField(choices=TIPO_POZO, required=False)
	cotatrapa = forms.DecimalField(max_digits=6, decimal_places=2, required=False)
	profundidad = forms.DecimalField(max_digits=6, decimal_places=2, required=False)
	cotafondo = forms.DecimalField(max_digits=6, decimal_places=2, required=False)
	material = forms.ChoiceField(choices=MATERIAL_POZOS, required=False)
	materialpates = forms.ChoiceField(choices=MATERIAL_PATES, required=False)
	diametro = forms.DecimalField(max_digits=20, decimal_places=2, required=False)
	largotrapa = forms.DecimalField(max_digits=20, decimal_places=2, required=False)
	seccionmayor = forms.DecimalField(max_digits=5, decimal_places=0, required=False)
	seccionmenor = forms.DecimalField(max_digits=5, decimal_places=0, required=False)
	numacometidas = forms.DecimalField(max_digits=2, decimal_places=0, required=False)
	origen = forms.CharField(max_length=20, required=False)
	observaciones = forms.CharField(widget=forms.Textarea(), required=False)

TIPO_IMBORNAL = (
	('', ''),
	('INDETERMINADO', 'Indeterminado'),
('BUZON', 'Buzon'),
('CUADRADO', 'Cuadrado'),
('HEXAGONAL', 'Hexagonal'),
('IMBORNAL NO ESTANDAR', 'Imbornal no estandar'),
('RECTANGULAR', 'Rectangular'),
('RECTANGULAR DOBLE', 'Rectangular doble'),
('RECTANGULAR PEQUENO', 'Rectangular pequeno'),
('REJILLA NO ESTANDAR', 'Rejilla no estandar'),
('SEMICIRCULAR', 'Semicircular'),   
)

class ImbornalesForm(forms.Form):
	codimbornal = forms.CharField(max_length=20)
	coorx = forms.DecimalField(max_digits=13, decimal_places=5)
	coory = forms.DecimalField(max_digits=13, decimal_places=5)
	tipo = forms.ChoiceField(choices=TIPO_IMBORNAL, required=False)
	origen = forms.CharField(max_length=20, required=False)
	observaciones = forms.CharField(widget=forms.Textarea(), required=False)

from django.contrib.gis.db import models
from django.contrib.auth.models import User
from demo.apps.obras.models import Obra

# Create your models here.

class Cuenca(models.Model):
# gid_cuenca = models.IntegerField(primary_key=True)
gid_obra = models.ForeignKey(Obra)
descripcion_cuenca = models.CharField(max_length=20)

class Colector(models.Model):
	# gid_colector = models.IntegerField(primary_key=True)
	# gid_cuenca = models.ForeignKey(Cuenca)
	# gid_material = models.ForeignKey(Material)
	# gid_obra = models.ForeignKey(Obra)
	referencia = models.CharField(max_length=20)
	# gid_seccion

Re: django on ubuntu

2014-11-22 Thread John
Mosharof

The standard Django tutorial works fine on Ubuntu. I would advise you,
though, to read up on virtualenv and do everything in a virtual python
environment. This may avoid a lot of pain with dependencies and is good
practice in any case.

John

On 22/11/14 15:42, Mosharof sabu wrote:
>  hi
>   i a going to start django on ubuntu . can any one please give me
> some link of good tutorial of django on ubuntu (from installation to
> 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/3f049723-779d-438e-907a-d2a921db7d14%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/5470CF72.3040207%40martinhome.org.uk.
For more options, visit https://groups.google.com/d/optout.


Re: Image input missing from POST request

2014-11-22 Thread Abhishek Batra
Hey Donarb,

Input fields are not required to be inside form elements, so long as they 
specify the form attribute as I have done. Check the form attribute here 
 
for reference.
Moreover, I have other input fields as well which are outside the form 
element, but they get successfully submitted.

Any other suggestions anyone?

Thanks,
Abhishek

On Saturday, November 22, 2014 11:03:39 PM UTC+5:30, donarb wrote:
>
> On Friday, November 21, 2014 7:56:54 PM UTC-8, Abhishek Batra wrote:
>>
>> Hi,
>>
>> This is probably not a Django issue, but just trying my luck.
>>
>> I have an input field corresponding to a Django ImageField in a Django 
>> template. Rendered, the HTML looks like:
>>
>> >   method="post" 
>>   id="profile_form"
>>   enctype="multipart/form-data">
>> ... (other input fields and elements)> id="id_profile_pic" name="profile_pic" type="file" />
>>
>> The corresponding View is an UpdateView. I found request.FILES to be 
>> empty and request.cleaned_data to contain 'profile_pic': None.
>>
>> I used firebug to track the POST data. It contained other fields but not 
>> profile_pic.
>>
>> Can anyone say why the file does not get uploaded? I've posted this 
>> question to StakOverflow 
>> 
>>  as 
>> well, in case someone wants reputation points.
>>
>> Thanks,
>> Abhishek Batra
>>
>
>
> The input field is outside the closing  tag so would not be 
> uploaded as part of the form. 
>

-- 
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/4ac4a48c-a2ce-4f06-b9fb-93223c88abec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django on ubuntu

2014-11-22 Thread Abhishek Batra
Hey Mosharof,

Two links I'd like to pass on:
1. 
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn
2. 
http://www.jeffknupp.com/blog/2013/12/18/starting-a-django-16-project-the-right-way/

Thanks,
Abhishek

On Saturday, November 22, 2014 9:12:13 PM UTC+5:30, Mosharof sabu wrote:
>
>  hi 
>   i a going to start django on ubuntu . can any one please give me 
> some link of good tutorial of django on ubuntu (from installation to 
> 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/70c70c16-3a67-42b7-904f-2087ef18d539%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django on ubuntu

2014-11-22 Thread Tim Chase
On 2014-11-22 18:01, John wrote:
> read up on virtualenv and do everything in a virtual python
> environment.

I can't second John's advice strongly enough.  I started programming
in Python over a decade ago and just finally broke down and
investigated virtualenv/virtualenvwrapper ~2yrs ago and it as made a
world of simplification in my projects/development.  It's well worth
the investment of time to get comfortable with the tools.

-tkc


-- 
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/20141122140650.1d7f6fc0%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.


Re: Is it wrong to disable a lot of the core django features?

2014-11-22 Thread John Rodkey
Gabriel,

How would you store groups for each company within the default "groups" 
database?  Our current database design is

Company
CustomUser belongs to Company
Roles belongs to Company (replacing default "Groups" with "Roles")
Roles has many Authorities (replacing default "Permissions" with 
"Authorities")
*additional tables will be configured for assigning Roles to CustomUsers 
most likely through a many to many - join

Using our very limited design above, what would you recommend approach be 
for using the providing "Grouping/Perms"?

On Saturday, November 22, 2014 3:58:17 AM UTC-6, Gabriel - Iulian Dumbrava 
wrote:
>
> Hello!
>
> I would suggest to not drop the use of the built in auth module. You have 
> many template and view tags, decorators, etc which are very helpful.
>
> You may, for example create a group for each company/branch then add each 
> user to their respective groups upon registration.
>
> Each groups may have custom permissions, so you are not stuck with the 
> built in add/edit/delete rights. You may create any type of permission and 
> check for it in verious places.
>
> vineri, 21 noiembrie 2014, 22:18:27 UTC+2, John Rodkey a scris:
>>
>> We are evaluating django for a new internal CRM project and have issues 
>> using many of the built in features including: the base user, permissions, 
>> and authentication.
>>
>> We do not wish to use the built-in admin...  The level of complexity for 
>> our permissions will be based on the employees job function/role.  While 
>> django does offer "Groups" under permissions, we have many subsidiaries 
>> which may name their own groups, this is our reasoning for dumping the 
>> built-in permissions.
>>
>> What we are trying to accomplish -
>>
>> 1. User registration and authorization based on users email address. (We 
>> believe this could be created with the "Custom User" information found in 
>> the docs.)
>>
>> 2. Depending on the users email domain (the subsidiary) they work for, 
>> they will only have access to that data (We do not believe django offers 
>> this, and will be building it)
>>
>> 3. Each company (subsidiary) will have their own permission roles/groups 
>> (We do not believe this is available in django, please correct if wrong).
>>
>> 4. Each user will be assigned role(s)/permission(s) for their company (We 
>> believe this will need to be a custom tool)
>>
>>
>> Is there a simple solution to altering the built-in authentication and 
>> permission to fit our needs?  
>>
>>
>>

-- 
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/5ac1c8d8-6dba-4538-976c-a38ada964420%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Obtaining content from Git

2014-11-22 Thread martin f krafft
Hello,

we have a Django project with a few pages that come from Git.
Currently, Apache rewrite rules serve those files statically (and
they make use of the same template/CSS as Django does, so the user
does not actually notice), and it's a massive hack and pain to keep
up-to-date.

Hence I was thinking: how much trouble would it be to have Django
reach into Git rather than its database and obtain data there to be
filled into template slots? Ideally, there'd be the possibility of
running a filter (e.g. reStructuredText) between Git and the
template rendering.

I've seen http://luispedro.org/software/git-cms, but that does way
more than just sourcing from Git. And it's not immediately obvious
to me how it even does the Git interaction.

What I envision is a storage layer (with optional caching) that
either fetches from the filesystem (with a Git checkout, using mtime
for cache expiration), or directly from a local Git repo (using
either commit or blob hash for cache expiration).

Does anyone know of such a module? Would it be hard to write? Where
would one start?

Thanks,

-- 
@martinkrafft | http://madduck.net/ | http://two.sentenc.es/
 
"imagine if every thursday your shoes exploded if you
 tied them the usual way. this happens to us all the time
 with computers, and nobody thinks of complaining."
-- jeff raskin
 
spamtraps: madduck.bo...@madduck.net

-- 
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/20141122212847.GA26476%40fishbowl.rw.madduck.net.
For more options, visit https://groups.google.com/d/optout.


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)


Re: is it worth going for version 1.6 for commertial project

2014-11-22 Thread Tom Lockhart

On Nov 22, 2014, at 4:53 AM, Krishnakant Mane  wrote:

> Hello all,
> I have been looking for some good discussion on this issue.
> i see there is not much difference between 1.7 and 1.6 as far as my 
> requirement goes.
> I have gone through the official docs for both in a kind of rappid specific 
> way.
> As it is I am not going to use ORM at all.

I am sticking with 1.6.x in case the new migration system needs a bit of extra 
time to iron out.

But since you are not using the ORM then you will not notice one way or the 
other. I’d probably go with 1.7.x…

hth

- Tom

-- 
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/FBBC7DD5-712A-46FF-A4FF-0A38495D1A6C%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2014-11-22 Thread Andreas Ka
Thanks for your help.

I really think there is something wrong with that part of the tutorial. A
small thing, but wrong.


> Check your settings file,
> are there two TEMPLATE_DIRS variables defined?

Nope.


This is where I placed it:

...
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
...


just tried this:

import mysite.settings as settings
print settings.TEMPLATE_DIRS
['D:\\Programming\\eclipse\\mysite\\templates']

so no: not empty.


Why is my file templates/admin/base_site.html never called
when I open http://127.0.0.1:8000/admin/ or
http://127.0.0.1:8000/admin/polls/  ?


Thanks.


On Fri, Nov 21, 2014 at 11:08 PM, donarb  wrote:

> On Friday, November 21, 2014 10:59:19 AM UTC-8, Andreas Ka wrote:
>>
>> I don't know.
>> How to test that?
>>
>>
>>
>> The things I have done were these:
>> https://docs.djangoproject.com/en/1.7/intro/tutorial02/#
>> customizing-your-project-s-templates
>>
>> mkdir templates
>> mkdir templates/admin
>> cp 
>> /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/base_site.html
>> templates/admin/
>>
>> ls -l templates/admin/base_site.html
>> -rw-r--r-- 1 user group 338 Nov 21 18:50 templates/admin/base_site.html
>> (and www-data is member of that group)
>>
>> nano templates/admin/base_site.html   -> changed it to what I want to see
>> nano mysite/settings.py  -->   TEMPLATE_DIRS = [os.path.join(BASE_DIR,
>> 'templates')]
>>
>> restarted the server.
>>
>>
>>
>>
>>
>>
>>
>> On Fri, Nov 21, 2014 at 3:24 AM, Collin Anderson 
>> wrote:
>>
>>> Hi,
>>>
>>> Do other templates work in that folder?
>>>
>>> Collin
>>>
>>>
>>> On Monday, November 17, 2014 4:12:27 PM UTC-5, Andreas Ka wrote:
>>>

 > Show your view code
 The tutorial did not create any view.py for the admin pages



 See https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-
 the-admin-look-and-feel

 We copied from the Django source files these two into:
 /mysite/templates/admin/base_site.html
 and
 /mysite/templates/admin/index.html



 and in https://docs.djangoproject.com/en/1.7/intro/tutorial02/#c
 ustomize-the-admin-change-list
 edited:


 admin.py

 from django.contrib import admin

 # Register your models here.

 from django.contrib import admin
 from polls.models import Choice, Question


 class ChoiceInline(admin.TabularInline):
 model = Choice
 extra = 3


 class QuestionAdmin(admin.ModelAdmin):
 fieldsets = [
 (None,   {'fields': ['question_text']}),
 ('Date information', {'fields': ['pub_date'], 'classes':
 ['collapse']}),
 ]
 inlines = [ChoiceInline]
 list_display = ('question_text', 'pub_date',
 'was_published_recently')
 list_filter = ['pub_date']
 search_fields = ['question_text']

 admin.site.register(Question, QuestionAdmin)


 ---



 On Mon, Nov 17, 2014 at 2:11 PM, Artie  wrote:

> Are you sure about correct path to your templates in views?
>
> Show your view code
>
> понедельник, 17 ноября 2014 г., 5:04:53 UTC+2 пользователь Andreas Ka
> написал:
>>
>> thanks for your answer.
>>
>> yes, I just tried that. Same result.
>>
>

> By now, I have understood much more about the templates.
>>
>

> But still, for the admin pages
>> mysite/templates/admin/base_site.html
>> doesn't work yet.
>>
>>
>> ...
>>
>
 On Sun, Nov 16, 2014 at 7:19 PM, RLF_UNIQUE  wrote:

> Obviously you've restarted the server and refreshed the page in such a
> way to ensure it's not a caching issue ?





>>>  --
>>> 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/4062bb51-88cd-4c2f-9430-bd6ab87c8902%
>>> 40googlegroups.com
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
> Check your settings file, are there two TEMPLATE_DIRS variables defined?
> Possibly you created one in your edit, but Django already has an empty one
> defined. If your edit was placed before the one that is already defined, it
> would end up empty, hence no override.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Djan