Re: Negative User ID's

2016-10-26 Thread James Schneider
On Oct 26, 2016 5:58 PM, "Mike Dewhirst"  wrote:
>
> On 27/10/2016 9:57 AM, mich...@zanyblue.com wrote:
>>
>> Hi,
>>
>> The Django contrib User model is used to create accounts in Django
applications.  I would like to keep accounts associated with real people
separate from accounts created for mailing list and/or service accounts.  I
was planning on using negative ID's for these accounts and can't see any
issue with this from a Django or DB point of view (would need to create and
manage my own sequence for this).
>>
>> Can anyone see any issue with this?
>
>
> Yes. It requires you (or those who maintain the application after you) to
manage something which the DBMS should manage "under the covers". If this
was my application I would be designing it with as few subtleties as
possible for the next person to support after I leave the project.
>

+1

I would also add that the easiest way to manage such a situation would be
to create a user profile in a separate table for any account that has a
real person attached to it.

There would be a OneToOne relationship between the user profile and the
User model. A simple join would pull all of the User objects that have
attached profiles, giving you the list of accounts attached to real people.

Django has an example of doing exactly this as a method of extending the
User model:

https://docs.djangoproject.com/en/1.10/topics/auth/customizing/#extending-the-existing-user-model

Work with the database (separate tables and joins), not against it (weird
negative indexing with no direct DB control).

If you're early on in development still, I would also strongly recommend
that you create a custom user model rather than relying on the included
User model. If you need to make changes to that model later, it is a royal
pain to create a custom one after your site is in production. Do this even
if you aren't changing anything right now. It is good practice and
recommended by Django:

https://docs.djangoproject.com/en/1.10/topics/auth/customizing/#substituting-a-custom-user-model

That page doesn't specifically have the recommendation, but you can see
evidence of it in the warnings posted in that section. Note that you should
plan on AUTH_USER_MODEL not ever changing during your project life cycle,
meaning that a custom user model will better future-proof your project in
the event your requirements change (allow longer user names, making email
required, etc.).

-James

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXkUgGn2jgqws5cnMVQ3E%2BqrJT%3D0agkW35R7r_%2BbJwrdA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Downside of using shortuuid as primary key

2016-10-26 Thread Suren Sth
I am considering to use shortuuid 
 as the primary key 
for my models.

Is there any downside to this?
Does it severely affect db indexing?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a569e980-8a02-469d-95ff-74d87beae13a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Negative User ID's

2016-10-26 Thread Mike Dewhirst

On 27/10/2016 9:57 AM, mich...@zanyblue.com wrote:

Hi,

The Django contrib User model is used to create accounts in Django 
applications.  I would like to keep accounts associated with real 
people separate from accounts created for mailing list and/or service 
accounts.  I was planning on using negative ID's for these accounts 
and can't see any issue with this from a Django or DB point of view 
(would need to create and manage my own sequence for this).


Can anyone see any issue with this?


Yes. It requires you (or those who maintain the application after you) 
to manage something which the DBMS should manage "under the covers". If 
this was my application I would be designing it with as few subtleties 
as possible for the next person to support after I leave the project.




Take care,
Michael.
--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fe7444f4-eb17-49d2-b553-3f3d8004b034%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c404713a-cf58-eca3-48d7-76f3c056210e%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Negative User ID's

2016-10-26 Thread michael
Hi,

The Django contrib User model is used to create accounts in Django 
applications.  I would like to keep accounts associated with real people 
separate from accounts created for mailing list and/or service accounts.  I 
was planning on using negative ID's for these accounts and can't see any 
issue with this from a Django or DB point of view (would need to create and 
manage my own sequence for this).

Can anyone see any issue with this?

Take care,
Michael.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fe7444f4-eb17-49d2-b553-3f3d8004b034%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using Socket Programmaing with django(for a chat room web app)

2016-10-26 Thread Daniel Furman
I'm a fan of socket.io

I've done this in PHP using laravel and redis. There are python pub/sub 
providers as well so swapping the laravel/PHP for Django and Python should be 
very doable.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fea93a3b-50be-4a3a-b287-418b66335859%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use Django forms for surveys

2016-10-26 Thread Luis Zárate
Hi, we are developing something like you want, but it's a premature project
right now, maybe in few months we launch our first stable version (survey
monkey be aware...), the project home page is

https://github.com/solvo/derb , see development branch for a updated
version.

So if you are interested in development let me know.



El jueves, 20 de octubre de 2016, Diego De La Vega 
escribió:
>
> El miércoles, 19 de octubre de 2016, 21:11:18 (UTC-3), James Schneider
escribió:
>>
>> On Sun, Oct 16, 2016 at 7:37 PM, Diego De La Vega 
wrote:
>>>
>>> Hi. This is my first question in this group.
>>> My problem is that I have to program a survey application and I would
like to have a hint about forms.
>>> The survey is +200 questions long and is divided in multiple subjects
(every subject is independent from the others) and mainly consists of
numeric (implemented as combo boxes) and text fields..
>>> The main problem is how to do for showing the relevant fields and not
the unwanted.
>>> Let me explan this: suppose that when the answer to question 1 is 1,
the survey continues with question 2, but if the answer is 2, then the
survey continues with question 16 and all the in between questions are
skipped.
>>> This is a very simple scenario, but almost all the flow of the survey
goes like this, making it complex to follow the order. Sometimes one must
skip a few questions but some others, one must skip only one, or a full
section of the questions, depending on the answer.
>>> Is there a recommended way to do so? Thanks in advance and sorry for my
English, I'm not a native English speaker (I hope all this mess can be
understood).
>>
>> Django FormTools may be another option, specifically the FormWizard:
https://django-formtools.readthedocs.io/en/latest/wizard.html
>> However, unless you have a very simple and deterministic way to figure
out the next question, it will likely turn in to a coding nightmare. The
step skipping has a bit of a learning curve to it. The FormWizard was
likely built with shorter and more linear workflows in mind.
>> Note that this package was included in Django core up until 1.7, this
package is (literally) the same thing, just broken out into a separate
package (most users did not use this functionality and it bloated the code
base if I remember the comments in the release notes).
>> While this can be super robust, it will probably not be easy.
>> -James
>>
>>
>
>
> I'll take a look to FormTools also. The next question is always
deterministic and going forward in the survey, but the path maybe a little
trickier, depending on ranges of answers of one or more questions.
> Thanks a lot.
> Diego
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/235bd523-c4bc-4849-b0fb-24f53b7094b3%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyMGRmKo4HZbL68UaAAMrTNPTeyajRmESkerJUN3Ofjrbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Running django on demand via my PyQt4 Standalone app

2016-10-26 Thread Dam ian
yeah you are right with the WoW effect :) and i know this framework but its 
to complex for me :P i prefere to use PyQt4, for example you have something 
like QT Designer where you can graphically deploy and customize the whole 
UI and then convert to pure python, what make me my work easier. If kivy 
had a usable graphicall editor i think i will choose this framework :) 

I used to do home automation, so I know you need an interface with very 
> high "WOW!" factor AND PORTABILITY. That is why I proposed you check kivy (
> http://kivy.org 
> ).
>  
> kivy is the kick-ass interface I'd use, bar none.
>
> this of course my opinion and recomendation, but you know YAHOO.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/827fd858-ee41-4e65-932c-7f23844044f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django menu and submenus

2016-10-26 Thread M Hashmi
Make sure you've included all the js/css ID/Class selectors in your newly
created submenu. Reason might be that old code is rendering something from
JS and your code missed it out. You can send code from before and after for
better understanding.

Regards,
Mudassar

On Wed, Oct 26, 2016 at 4:24 AM, Tetchi Boris Armel Kena <
kena.tet...@gmail.com> wrote:

> i'm coding a geonode app based on django and python architecture but also
> bootstrap. i change the boot strap navigation menu with a simple html and
> css but my probleme is that the submenu do not appear on the page please
> help me.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/313cc973-16fd-4244-bb2f-707524f8ab83%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANoUts5Xiu1p1zeOgeP9Z5cxMdmi6NK4vKS7v_4yXC8iZ-S5Pw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


submenu from do not appear

2016-10-26 Thread Tetchi Boris Armel Kena
{% load i18n avatar_tags %}


  


 
{% block title %}{{ SITE_NAME }}{% endblock %}
{% block head %}
  {% if DEBUG_STATIC %}
  
  
  
  
  
  {% else %}
  
  {% endif %}
  
  
  [ng\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none
 
!important;}
  {% block extra_head %}
  {% endblock %}
{% endblock %}


  
  
  

{% block header %}



  
Toggle navigation



  
  




{% endblock header %}




  



  
  

  http://10.66.200.167/sie/;>Accueil


  http://10.66.200.167/sie/index.php/a-propos-du-sie;>A propos du 
SIE
 

  http://10.66.200.167/sie/index.php/a-propos-du-sie/information-sur-le-projet.html;>Information
 
sur le projet


  http://10.66.200.167/sie/index.php/a-propos-du-sie/information-sur-le-projet.html;>Information
 
sur le projet


  http://10.66.200.167/sie/index.php/a-propos-du-sie/definition-des-themes.html;>Definition
 
des themes


  http://10.66.200.167/sie/index.php/a-propos-du-sie/actualites.html;>Actualites


  http://10.66.200.167/sie/index.php/a-propos-du-sie/glossaire.html;>Glossaire




  http://10.66.200.167/sie/index.php/information-environnementale.html;>Information
 
environnementale


  http://10.66.200.167/sie/index.php/information-environnementale/cadre-de-vie.html;>Cadre
 
de vie


  http://10.66.200.167/sie/index.php/information-environnementale/cadre-de-vie/sante-et-environnement.html;>Sante
 
et environnement


  http://10.66.200.167/sie/index.php/information-environnementale/cadre-de-vie/eco-tourisme.html;>Eco-tourisme




  http://10.66.200.167/sie/index.php/information-environnementale/elements-de-lenvironnements.html;>Elements
 
de lenvironnements


  http://10.66.200.167/sie/index.php/information-environnementale/elements-de-lenvironnements/air-atmosphere.html;>Air-Atmosphere


  http://10.66.200.167/sie/index.php/information-environnementale/elements-de-lenvironnements/biodiversite.html;>Biodiversite


  http://10.66.200.167/sie/index.php/information-environnementale/elements-de-lenvironnements/eau.html;>Eau


  http://10.66.200.167/sie/index.php/information-environnementale/elements-de-lenvironnements/forets.html;>Forets


  http://10.66.200.167/sie/index.php/information-environnementale/elements-de-lenvironnements/aires-protegees.html;>Aires
 
protegees


  http://10.66.200.167/sie/index.php/information-environnementale/elements-de-lenvironnements/autres-vegetations.html;>Autres
 
vegetations


  http://10.66.200.167/sie/index.php/information-environnementale/elements-de-lenvironnements/sol.html;>Sol




  http://10.66.200.167/sie/index.php/information-environnementale/facteurs-et-activites.html;>Facteurs
 
et activites


  http://10.66.200.167/sie/index.php/information-environnementale/facteurs-et-activites/agriculture.html;>Agriculture


  http://10.66.200.167/sie/index.php/information-environnementale/facteurs-et-activites/bruits.html;>Bruits


  http://10.66.200.167/sie/index.php/information-environnementale/facteurs-et-activites/changement-climatique.html;>Changement
 
climatique


  http://10.66.200.167/sie/index.php/information-environnementale/facteurs-et-activites/dechets.html;>Dechets


  http://10.66.200.167/sie/index.php/information-environnementale/facteurs-et-activites/deversement-et-autres-rejets.html;>Deversement
 
et autres rejets


  http://10.66.200.167/sie/index.php/information-environnementale/facteurs-et-activites/elevage.html;>Elevage


  http://10.66.200.167/sie/index.php/information-environnementale/facteurs-et-activites/energie.html;>Energie


  http://10.66.200.167/sie/index.php/information-environnementale/facteurs-et-activites/industrie.html;>Industrie
 

Django menu and submenus

2016-10-26 Thread Tetchi Boris Armel Kena
i'm coding a geonode app based on django and python architecture but also 
bootstrap. i change the boot strap navigation menu with a simple html and 
css but my probleme is that the submenu do not appear on the page please 
help me.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/313cc973-16fd-4244-bb2f-707524f8ab83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Silently continuing past an exception: is this proper? how else can I do this?

2016-10-26 Thread 'Tom Evans' via Django users
On Sun, Oct 23, 2016 at 1:39 PM, Andrew Chiw
 wrote:
> It seems there's a problem with my code, because you're just supposed to
> pass a dict to DocumentForm (or any modelForm really), not a model instance.
>
> I actually want to make a DocumentForm initialized with values from an
> existing Document, so I can list existing Documents and provide a way to
> re-upload them and edit their description. Is this the right way to do it?

DocumentForm(instance=d)

I can't see anywhere in the docs where this is explicitly specified as
the stock ModelForm API, but it is firmly implied by this page:

https://docs.djangoproject.com/en/1.10/topics/forms/modelforms/#modelform

The first positional argument is expected to be data submitted by the browser.

Cheers

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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1JQiqaEbKrkzhRN2u8NU5tFO5jWQZgaqDWcLAXAKcKaDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Project Structure

2016-10-26 Thread Vinicius Assef
See this link: 
https://docs.djangoproject.com/en/1.10/intro/tutorial01/#creating-the-polls-app

The box "Projects vs app" can help you.

On 26 October 2016 at 04:35, Deep Shah  wrote:
> I have a django project which is a loyalty program for restaurants. The
> different database tables are- Users (and extending it with User Profiles),
> Restaurant Company (the entire chain), Branches, Offers, Points (points
> which users get on visiting a particular restaurant) etc.
>
> How do I structure my project? Which of these would be my apps, and which
> model would come under which app?
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d44e29a8-7fdd-42f1-8c4a-646e75f2d148%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFmXjSB-cGDVhOviD1wift6%2BuDt8aU%2B%3DcKCW7brfk8p63E6n_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Project Structure

2016-10-26 Thread Deep Shah
I have a django project which is a loyalty program for restaurants. The 
different database tables are- Users (and extending it with User Profiles), 
Restaurant Company (the entire chain), Branches, Offers, Points (points 
which users get on visiting a particular restaurant) etc.

How do I structure my project? Which of these would be my apps, and which 
model would come under which app?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d44e29a8-7fdd-42f1-8c4a-646e75f2d148%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Methods in Models

2016-10-26 Thread Deep Shah
This makes sense! Thanks!

On Monday, October 24, 2016 at 1:17:26 PM UTC+5:30, Deep Shah wrote:
>
> What kind of methods should be part of the models and what should be in 
> the views? Can anyone give me an example of a method which should be in a 
> Model than the views 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c3bec412-57db-4732-91b6-b53cc39d2912%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.