Re: Django : DRF Token based Authentication VS JSON Web Token

2015-07-23 Thread Gergely Polonkai
Hello, after a quick read I cannot find any essential differences between the two, in regards of authentication. JWT, however, is much more fine grained and has a bunch of token manipulation options. Best, Gergely On 24 Jul 2015 03:01, "Ankit Agrawal" wrote: > >Hi everyone, > > > I am b

Re: retrieve row with maximum field value django

2015-07-23 Thread James Schneider
Use a combination of order_by('-age') and first() on your query set. MyModel.objects.order_by('-age').first() https://docs.djangoproject.com/en/1.8/ref/models/querysets/#order-by Obviously that only pulls the "first" object even if multiple objects have that same age, so you may need additional

Re: Django Model field : Ordered List of Foreign Keys

2015-07-23 Thread Alex Heyden
There are options, but here's what I'd do: class Stop(models.Model): name = models.TextField() #use CharField if not using Postgres latitude = models.DecimalField() longitude = models.DecimalField() route = models.ForeignKey('Route') sequence = models.IntegerField() class Meta: u

Django Model field : Ordered List of Foreign Keys

2015-07-23 Thread Ankit Agrawal
I have a `Route` model which should store an ordered list of stops along that route. How should I go about modeling this relation? class Stop(models.Model): name = .. latitude = .. longitude = .. class Route(models.Model): stops_list = # Ordered list o

Re: How to use Python Requests Module to upload images to Django Application?

2015-07-23 Thread Ted Thomas
My Python code started working after I changed on line. Changing: files_dct = {filename:fobj} to: files_dct = {('photo',(filename, fobj,'image/jpg'))} Now it works. My conjecture about the need for different HTTP-headers was wrong. The working code has not changed the headers receive

retrieve row with maximum field value django

2015-07-23 Thread Nkansah Rexford
Say I have a model class MyModel(models.Model) name = models.CharField(max_length=20) age = models.IntergerField() How can I find the maximum based on the 'Age' field number and retrieve that whole object? I understand aggregates allows me to find and retrieve the maximum number when gi

Django : DRF Token based Authentication VS JSON Web Token

2015-07-23 Thread Ankit Agrawal
Hi everyone, I am building a real world application where users will access the app primarily from Android, iOS devices as well as Desktops. >From my elementary research, I have realized that token based authentication mechanism is more better and elegant for client-server models as

How to use Python Requests Module to upload images to Django Application?

2015-07-23 Thread Ted Thomas
I am developing a django application that primarily uses web browsers to upload scientific data that includes some image files. Currently, the application works fine when Firefox or Chrome are used. Both images and other data are correctly uploaded. Occasionally users need to upload larger am

Re: Thumbnails In Django

2015-07-23 Thread divyanshi kathuria
On Wednesday, July 22, 2015 at 3:12:47 AM UTC+5:30, Robin Lery wrote: > > Yes. I would like to add easy-thumbnails too. Both are great! > I used easy-thumbnails. But it doesn't store the thumnails in my database. I want three fields to get populated on loading the image : image, thumbnail_larg

Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

2015-07-23 Thread Carl Meyer
Hi Gergely, On 07/23/2015 02:27 PM, Gergely Polonkai wrote: > Yes, you are right, my attempt is not the solution to your problem; it > seems that this m2m field really cannot be modified like this. With some > slight modifications, though, it may be. > > 1) create the through table > 2) migrate d

Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

2015-07-23 Thread Gergely Polonkai
Hello, I'm sorry, I was not around my mailbox lately. Yes, you are right, my attempt is not the solution to your problem; it seems that this m2m field really cannot be modified like this. With some slight modifications, though, it may be. 1) create the through table 2) migrate data with RunPytho

Re: Allow users to submit django form once per day

2015-07-23 Thread Carl Meyer
On 07/23/2015 01:32 PM, Nkansah Rexford wrote: > You can save the datetime of the last form submission and check > whether its oneday or not in the view. If its one day then show pass > the form or else dont. > > Hope this helps. > > > I do know I have to save the date stamp, but

Re: Allow users to submit django form once per day

2015-07-23 Thread Nkansah Rexford
> > You can save the datetime of the last form submission and check whether > its oneday or not in the view. If its one day then show pass the form or > else dont. > > Hope this helps. > I do know I have to save the date stamp, but the question is Where? On the model class, the user class, or

Re: Why is Admin login template at admin/login.html instead of registration/login.html?

2015-07-23 Thread Carl Meyer
Hi Carsten, On 07/23/2015 11:41 AM, Carsten Fuchs wrote: > Am 23.07.2015 um 18:49 schrieb Tim Graham: >> The admin login only allows staff users to login so it makes sense to >> me that if you >> wanted to add regular user login to your site, it should have separate >> URLs. > > I think what conf

Limit initial admin queryset

2015-07-23 Thread Lee Hinde
I have a model - Registrations. 97% of the time a user wants to see 'todays' registrations when viewing this model in admin. Is there a way to set the initial display of records, but allow full access thereafter? The example in admin.get_queryset assumes I want to manage each query. In my case, I

Re: Buttons

2015-07-23 Thread Jake Rudolph
Thank you for your response! I am trying to follow AJAX tutorials, and I keep running into an issue with the URLConfs. My current admin and index page use something like this: urlpatterns = [ url(r''^admin/', include(admin.site.urls)), ] But the when implementing AJAX, everything has said

Re: Why is Admin login template at admin/login.html instead of registration/login.html?

2015-07-23 Thread Carsten Fuchs
Hi Tim, many thanks for your reply! Am 23.07.2015 um 18:49 schrieb Tim Graham: The admin login only allows staff users to login so it makes sense to me that if you wanted to add regular user login to your site, it should have separate URLs. I think what confuses me is the fact that (in the A

Re: Why is Admin login template at admin/login.html instead of registration/login.html?

2015-07-23 Thread Carl Meyer
On 07/23/2015 10:49 AM, Tim Graham wrote: > The admin login only allows staff users to login so it makes sense to me > that if you wanted to add regular user login to your site, it should > have separate URLs. > > As for the template issue, it seems to me the > admin/template/registration template

Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

2015-07-23 Thread Carsten Fuchs
Hi Carl, Am 23.07.2015 um 18:28 schrieb Carl Meyer: Overall I think it might be simpler to go with your initial approach. I'd first rename the old field to some other temporary name (you don't have to update any other code to use this name, as you'll commit all of these migrations in one commi

Re: Why is Admin login template at admin/login.html instead of registration/login.html?

2015-07-23 Thread Tim Graham
The admin login only allows staff users to login so it makes sense to me that if you wanted to add regular user login to your site, it should have separate URLs. As for the template issue, it seems to me the admin/template/registration templates should be more like admin/login.html and namespac

Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

2015-07-23 Thread Carl Meyer
Hi Carsten, On Thursday, July 16, 2015 at 12:44:55 PM UTC-6, Carsten Fuchs wrote: > > Am 2015-07-16 um 18:15 schrieb Gergely Polonkai: > > 1) create the "through" model, add it to the migration file > > 2) migrate all m2m instances (e.g. iterate over all Bereich objects then > > iterate through

Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

2015-07-23 Thread Carsten Fuchs
Am 16.07.2015 um 16:05 schrieb Carsten Fuchs: Alas... are there any viable alternatives to this? I'd be very grateful for any hint! :-) Anyone please? Best regards, Carsten -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe fr

Re: Allow users to submit django form once per day

2015-07-23 Thread Maxim Boyarskiy
You can check how django rest framework solves it: http://www.django-rest-framework.org/api-guide/throttling/ -- 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 dja

Re: Allow users to submit django form once per day

2015-07-23 Thread Robin Lery
You can save the datetime of the last form submission and check whether its oneday or not in the view. If its one day then show pass the form or else dont. Hope this helps. On 23 Jul 2015 20:38, "Nkansah Rexford" wrote: > I want to allow users to submit a django form once, and only once > everyd

Allow users to submit django form once per day

2015-07-23 Thread Nkansah Rexford
I want to allow users to submit a django form once, and only once everyday. After submitting the form, the form wouldn't even show (server-side checkings, I don't want to use JS or client side thing; easily 'tamper-able') What is the best way to do so in Django? -- You received this message b

Why is Admin login template at admin/login.html instead of registration/login.html?

2015-07-23 Thread Carsten Fuchs
Dear Django fellows, using Django 1.8.3, I see that the Admin contrib uses the Auth contrib's views (in contrib/admin/sites.py). The implementation overrides the auth views' defaults only if explicitly specified in the AdminSite object. For example, changing the user password is implemented i

Re: Help needed for big django project (crm+shop+cms+autoresponder). What apps shall I build on?

2015-07-23 Thread Avraham Serour
I know this is an old thread, but I bumped on it while cleaning my inbox. In any case if it still relevant I recommend looking at treee.io, the website is down but you can take a look at the code at github ( https://github.com/treeio/treeio) On Sat, Jun 6, 2015 at 6:55 PM, Luis Zárate wrote: >

Use django-console app url in template

2015-07-23 Thread Info Test
I can access to django-console app with: 127.0.0.1:8000/admin/console. How to link this with href = "url " in template -- 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

Re: Using git to control the version for an app in my project

2015-07-23 Thread durirompepc
I refer to a new project (in all the possible meanings). When I use *startapp* to create an app, I want to only git (as you would do for any other thing) that app, nothing more: django-admin startproject myproject cd myproject python3 manage.py startapp myapp cd myapp git init It's very simple:

Select existing data or creating a new one, with Django forms

2015-07-23 Thread João Luiz Lorencetti
My model have a field called 'city', it's a foreign key to City model. The user have the option to select a city in a dropdown menu (Select widget), or click in a button and write the name of a new (not present in the database) city. Using a ModelForm, I added an extra field called 'new_city' t