Re: Customised handling for wrong passwords entered in Login page in Django.

2016-05-03 Thread Arun S
Thanks Simon, I could now do all kinds of Session logging by handling the signals. Great Information. Cheers Arun. On Tuesday, May 3, 2016 at 7:33:45 PM UTC+5:30, Simon Charette wrote: > > Hi Arun, > > If you only want to log failed login attempts I suggest you connect a > receiver to > the

Re: manipulate n insert field values

2016-05-03 Thread Shameema Mohsin
#Z value calculation # #step1: converting lat and long to int latitude int = (latitude + 90) × 10^6 longitude int = (latitude + 180) × 10^6 #note 10^6 = 100 We compute the Morton value for a spatial point P (x, y) by interleaving the bits of x and y. For

Re: manipulate n insert field values

2016-05-03 Thread Shameema Mohsin
#Z value calculation # #step1: converting lat and long to int latitude int = (latitude + 90) × 10^6 longitude int = (latitude + 180) × 10^6 #note 10^6 = 100 We compute the Morton value for a spatial point P (x, y) by interleaving the bits of x and y. For

Re: Using django login functionality in a non django app

2016-05-03 Thread Larry Martell
So I have been working on this and I think I am very close. I have a view /falcon_login/ and I have the @login_required decorator on it. It returns user info in JSON. In my Qt app I invoke /falcon_login/ and because the user is not logged in the django login page is brought up. After they login my

Re: Querying a model with a ForeignKey

2016-05-03 Thread ofeyofey
No problem. I will post if i figure it out. Thanks very much for your help On Tuesday, 3 May 2016 18:43:53 UTC+1, ofeyofey wrote: > > I have two tables in a sqlite3 DB, PostModel and TopicModel. The PostModel > has fields id, post, author, pub_date and topicid. This last fields topicid > has a

Re: Querying a model with a ForeignKey

2016-05-03 Thread Aaron Cannon
I fear doing this efficiently is beyond my limited abilities. Will look forward to other answers you might get. Good luck. Aaron On 5/3/16, ofeyofey wrote: > Aaron thanks for looking at this. > I understand what you did now, and that is great. > But I actually realised

Re: Querying a model with a ForeignKey

2016-05-03 Thread ofeyofey
Aaron thanks for looking at this. I understand what you did now, and that is great. But I actually realised that the views I showed are not the correct ones and the view I want to do this in called 'init' actually has no id. So How might I get one instance of each topic where if there is more

Re: Querying a model with a ForeignKey

2016-05-03 Thread Aaron Cannon
Does pModel = PostModel.objects.filter(topicid_id=pk).order_by('-pub_date')[0] work for you? Also, I believe it would be more conventional if you named your topicid field simply topic, your post field as body, and your topic field as name. Luck. Aaron On 5/3/16, ofeyofey

Django formset security and injecting PKs in formset hidden id fields

2016-05-03 Thread Rob Ladd
I've noticed something troubling in Django formsets: Each formset.form has a hidden field with the id of the model being edited. All one would need to do is change this id and submit, and the default formset clean() or save() methods don't bat an eye. I would think that it wouldn't be too

Re: Django formset hidden id field

2016-05-03 Thread Rob Ladd
Carl Meyer said: "Whatever queryset you pass to the model formset limits the available rows for editing. The end user can edit the PK to refer to any item in that queryset, but not any item in the table. " That's not true, based on my observation. As long as the PK refers to any object of

Querying a model with a ForeignKey

2016-05-03 Thread ofeyofey
I have two tables in a sqlite3 DB, PostModel and TopicModel. The PostModel has fields id, post, author, pub_date and topicid. This last fields topicid has a foreignkey to the other table Postmodel. PostModel has the fields id, topic. There is a one-to-many relation from the TopicModel to the

Re: How and where should I put a version number in my Django project?

2016-05-03 Thread Scot Hacker
Another approach is to use git commit IDs and/or git tags to track releases, then display that data (and commit date) in a template, only to superusers or some group. I did a little blog post about this recently: http://blog.birdhouse.org/2016/04/22/django_git_template_tag/ ./s -- You

Re: How and where should I put a version number in my Django project?

2016-05-03 Thread Nate Granatir
You can put the version for your project in: my_project/my_project/__init__.py (same folder as settings.py) like this: __version__ = '1.0.27' Then your project acts as a python module, and you can refer to the version number, for instance in your settings.py, as: GRAPPELLI_ADMIN_TITLE = 'My

Re: What's the best way to auto convert a model field values before it is rendered?

2016-05-03 Thread Derek
I would add it as a custom model method - see: https://docs.djangoproject.com/es/1.9/topics/db/models/#model-methods So, for example: class Temperature(models.Model): user = models.ForeignKey(User, unique=False) celcius = models.FloatField(null=True, blank=True) def

Re: Customised handling for wrong passwords entered in Login page in Django.

2016-05-03 Thread Simon Charette
Hi Arun, If you only want to log failed login attempts I suggest you connect a receiver to the user_login_failed signal[1] instead. Cheers, Simon [1] https://docs.djangoproject.com/en/1.9/ref/contrib/auth/#django.contrib.auth.signals.user_login_failed Le mardi 3 mai 2016 06:01:59 UTC-4, Arun

Re: Chinese humanize number conversion

2016-05-03 Thread Simon Charette
Hi Malte, The conversion takes place in the intword template filter[1]. The Chinese translation of the intword_converters can be found in the locale directory of the humanize application[2]. These translations are handled over Transifex[3]. Cheers, Simon [1]

Re: Python3 + makemessages = "invalid multibyte sequence"

2016-05-03 Thread Torsten Bronger
Hallöchen! Torsten Bronger writes: > With Django 1.9.5 and Python 3, I get warnings like > > ./jb_common/templates/404.html.py:35: invalid multibyte sequence > > when I run "manage.py makemessages". The problem occurs only in > HTML files with (validly) UTF-8-encoded characters in them. In >

How to access selected options from a select list to show them in a table ?

2016-05-03 Thread xhoikallupi
So i have a select list and a table,and i want to show only the data that corresponds the selected item. This is my index.html file Owners --- {% for owner in owners %} {{ owner.person_id }} {{ owner.first_name }} {{ owner.last_name }} {% endfor %}

Customised handling for wrong passwords entered in Login page in Django.

2016-05-03 Thread Arun S
Hi, I was trying to add a Customised View to Handle Wrong Passwords entered by Users. As of now, Djangos Framework just outputs, "Invalid Username or Password" when a Wrong password is entered by the User. This doesnt allow much flexibility if some information such as Invalid Access needs to

Re: manipulate n insert field values

2016-05-03 Thread Erik Cederstrand
> Den 3. maj 2016 kl. 02.45 skrev Shameema Mohsin : > > > Stil stuck with the z order calculation and usage of the property field. > Kindly help. I am new to Django, only knows php well. Where are you stuck? Show your error messages, current non-working code and

Re: How and where should I put a version number in my Django project?

2016-05-03 Thread Martín Torre Castro
I will look it at night. Thanks On 3 May 2016 at 11:36, Mike Dewhirst wrote: > On 3/05/2016 7:21 PM, Martin Torre Castro wrote: > >> I'm making a Django project consisting of several apps and I want to use >> a version number for the whole project, which would be useful

Re: How and where should I put a version number in my Django project?

2016-05-03 Thread Mike Dewhirst
On 3/05/2016 7:21 PM, Martin Torre Castro wrote: I'm making a Django project consisting of several apps and I want to use a version number for the whole project, which would be useful for tracking the status of the project between each time it comes to production. I've read and googled and

How and where should I put a version number in my Django project?

2016-05-03 Thread Martin Torre Castro
I'm making a Django project consisting of several apps and I want to use a version number for the whole project, which would be useful for tracking the status of the project between each time it comes to production. I've read and googled and I've found how to put a version number for each

Re: Integer field choice list keeps triggering migration

2016-05-03 Thread Mike Dewhirst
On 3/05/2016 4:58 PM, jorrit...@gmail.com wrote: I have the following model and choice list: BTW_TARIEF_CHOICES = { (1, '6%'), (2, '21%'), (3, '0%'), } Migrations see these changes as model changes. The model does change because it gets actual new choices in its definition. At any

Re: Help with defining Models for ManyToMany and OneToMany relationships...

2016-05-03 Thread Michal Petrucha
Hi Bruce, On Mon, May 02, 2016 at 02:31:37PM -0700, Bruce Whealton wrote: > Michal, >I had to read your response a few times but I finally got it. I was > reading > that all migrations are created in development only and then applied during > production. > So, during development you

Re: makemigrations throws table does not exist error

2016-05-03 Thread Michal Petrucha
On Mon, May 02, 2016 at 02:01:24PM -0700, Lucian Willoughby wrote: > I am trying to re-create an older project from a git repository. I do not > have the original MySql database. I emptied the migration folders and tried > to run "python manage.py makemigrations" which resulted in the following

upgrade from 1.4 to 1.8

2016-05-03 Thread Samarjeet Singh
The problem i am facing is : 1.login to the app every thing is fine 2.logout 3.login back again (then if i click on any tab it redirects me to the login page back again ) any idea what can be the problem ??? PS:one more thing previously when the user does a login the number of key was same in

Re: regarding Session ID and cookie validation

2016-05-03 Thread Samarjeet Singh
thanks for the reply what my main concern is that does django logs every bad cookie (if the cookie is not correct does it logs this ( no it does not i think) but what does it do except not letting the user to enter does it raise any exception ) On Sunday, May 1, 2016 at 7:34:55 PM UTC+5:30,

Integer field choice list keeps triggering migration

2016-05-03 Thread jorrit787
I have the following model and choice list: BTW_TARIEF_CHOICES = { (1, '6%'), (2, '21%'), (3, '0%'), } class FactuurItem(models.Model): naam = models.CharField(max_length=100) factuur_naam = models.CharField(max_length=100) eenheid = models.CharField(max_length=10)

Re: Django Multiple User Profiles Best Practices

2016-05-03 Thread Peter of the Norse
> On Apr 6, 2016, at 9:41 PM, Sudhanshu Shekhar wrote: > > Hi, > > I am creating a tutor-student forum using Django. For which I need to have > two different user profiles, one for students and one for teachers. However, > I am unsure about the best way to do this. I