Re: Controlling access at table row level

2015-11-06 Thread Steve West
Thanks for the suggestions. I'll give them a try. Cheers Steve -- 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

Re: django admin - You don't have permission to edit anything

2015-11-06 Thread Benjamin Smith
Hello, Yes I thought so too, but in the example there is no *is_superuser *property provided neither in the User models or in the User manager. Therefore, I just copied the example from the django doc and tried running it. After creating the superuser, I can edit the models. I have no Idea what I a

Re: django admin - You don't have permission to edit anything

2015-11-06 Thread Andreas Kuhne
Hi, Check the PermissionsMixin. In that mixin you add the is_superuser field. It also adds the relations to the auth group for group permissions and so on. And the django admin site checks for permissions by calling the has_perm() method on your user model. The has_perm() method always returns Tru

Django Cms 3.1.3 Search Using Haystack

2015-11-06 Thread nAncy sharma
Hi there, I am working with django cms 3.1.3 to build a website. I am trying to add functionality of "SEARCH" to the website .Tried using haystack with elasticsearch,whoosh,simple,xapian for which i followed the haysatck documentaion. Still unsuccessful in achieving the functionality. Is the d

Re: Prefetch object with to_attr set to the same name as the field triggers rows deletions

2015-11-06 Thread Michele Ciccozzi
Thank you very much, Simon, for the detailed answer. Now I'm digging through Django code, pull requests, and tickets, and it's all very interesting. Thank you also for the reminder of incoming deprecations: we'll definitely be on the lookout for that! All the best, Michele On Fri, Nov 6, 2015 at

Re: update_or_create() always creates (or recreates)

2015-11-06 Thread Yunti
Carsten , Thanks for your reply, A note about the last statement: If a Supplier object has the same unique_id, and all other fields (in `defaults`) are the same as well, logically there is no difference between updating and not updating – the result is the same. The entry in the database is

Re: Safe tag is working differently for different view.

2015-11-06 Thread sonu kumar
Yeah , I am sure both are using same template. I am using same template on many pages. On all pages it's working fine. Only on one page question answer it's not working as expected. I couldn't find any solution till now. On Thursday, November 5, 2015 at 8:48:05 PM UTC+5:30, Collin Anderson wrot

Re: update_or_create() always creates (or recreates)

2015-11-06 Thread Yunti
Carsten , Thanks for your reply, A note about the last statement: If a Supplier object has the same unique_id, and all other fields (in `defaults`) are the same as well, logically there is no difference between updating and not updating – the result is the same. The entry in the database is

Re: update_or_create() always creates (or recreates)

2015-11-06 Thread Jani Tiainen
Your problem lies on the way Django actually carries out create or update. As name suggest, create or update does either one. But that's what you don't want - you want conditional update. Only update if certain fields have been changed. Well this can be done few ways. So you want to do "up

Re: update_or_create() always creates (or recreates)

2015-11-06 Thread Yunti
Jani, Thanks for your reply - you explained it much more concisely than I did. :) Good to have it confirmed that update_or_create() doesn't quite do what I needed - I was confused as to whether it would or not. Thanks for taking the time to do that function, that looks ideal. I'll test it out.

Re: update_or_create() always creates (or recreates)

2015-11-06 Thread Dan Tagg
Hi Yunti, You could go up a level in the structure of your application and apply the logic there, where there is more support. Are you using Django forms? The ModelForm class pretty much does what you want, it examines form data, validating it against its type and any validation rules you have s

Custom Templates in Django Sitemaps Index

2015-11-06 Thread Andreas Dickow
See my new tutorial on Custom Templates in Django Sitemaps: https://biz-factory.de/django-sitemap-index-tutorial/ -- 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

Re: update_or_create() always creates (or recreates)

2015-11-06 Thread Yunti
Hi Dan, Thanks for the suggestion, it's a web scraper (run as a django management command) which then saves the data to the database via the Django ORM. Given it's a scraper rather than a form (or view) is the above suggested function an ok way to proceed or would you suggest something else is

Re: update_or_create() always creates (or recreates)

2015-11-06 Thread Dan Tagg
If you are web scraping you really need your code to be as efficient as possible and to do as little as possible. Firstly, make sure you are using everything the servers of the websites you are scraping are giving you to decide whether to bother downloading the page. For example, check the etag and

Re: django admin - You don't have permission to edit anything

2015-11-06 Thread Benjamin Smith
Yes, that was it. I changed the user manager function to create superuser into this def create_superuser(self, email, first_name, last_name, username, date_of_birth, password, **kwargs): user = self.create_user( email, first_name=first_name, last_name=la

Re: update_or_create() always creates (or recreates)

2015-11-06 Thread Yunti
Thanks - you've definitely given me some stuff to think about. I'm doing XHR requests - returning JSON for the scraping (but probably later will have normal pages so I will definitely look at your Etag suggestion - I'm not familiar with that so will look into it). Given it's XHR and JSON I pr

what is best way to pass form from non editable view to a editable window then save it and send values back to previously non editor view

2015-11-06 Thread sushovan majumdar
I have a django view which has simple form with key value pair. I have made the fields non editable. I'm providing a edit button which will open a new window dialog and there i will load the same form in editable view and provide option to save or add new rows to form. When user clicks on save o

Trouble with Intermediate Page for admin Interface

2015-11-06 Thread Jonny Mcgow
So I’ve been working for a couple days now on setting up a pretty basic bulk edit action for my server that consists of selecting all of the objects you want to change a designated field on, being redirected to an intermediate page, entering a new integer value for the designated field, and t

Spatialite for GeoDjango can't be loaded on Ubuntu Wily Werewolf

2015-11-06 Thread Berthier Lemieux
Hi! When I try to use django.contrib.gis.db.backends.spatialite as my db engine on Ubuntu Wily Werewolf (15.10), I am getting the following error: *django.core.exceptions.ImproperlyConfigured: Unable to load the SpatiaLite library extension "libspatialite.so.7" because: /usr/local/lib/libs

n00b question about displaying data in order by day

2015-11-06 Thread Becka R.
Hi -- I'm building a scheduling app for my burning man camp. There are seven days (Mon-Sun), and each day has two meals, and people can sign up for the available shifts. Here's my table: class mealShifts(models.Model): Sunday = "Sunday" Monday = "Monday" Tuesday = "Tuesday" Wednesday = "Wed

Unable to get the locale encoding in Ubuntu 12.04, Apache/2.4.7, libapache2-mod-wsgi-py3, Python 3.4, Django 1.86

2015-11-06 Thread Abhijit Nandy
I am trying to setup a simple Django app using this tutorial: https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-14-04 My configuration is: Ubuntu 12.04, Apache/2.4.7, libapache2-mod-wsgi-py3, Python 3.4, Django 1.86 I keep getting