Re: Any way to not create default Django permissions?

2012-01-18 Thread Stodge
Awesome - thanks for the description. On Jan 18, 9:45 am, Tom Evans wrote: > On Wed, Jan 18, 2012 at 1:50 PM, Stodge wrote: > > I have a particular use case where the default permissions don't work > > for me. I know I can create a custom auth backend, but if I do that,

django-cas-consumer template question

2011-04-29 Thread Stodge
I installed django-cas-provider and django-cas-consumer. I configured the consumer to use the CAS service offered by the provider and I added a base.html template for the consumer. Is this base template supposed to contain the login form? Or is the login form supposed to be available on teh provide

Re: django-cas-consumer template question

2011-04-29 Thread Stodge
vice with django-cas-provider. > > On Fri, Apr 29, 2011 at 7:30 PM, Stodge wrote: > > django-cas-consumer > > -- > Alex Kamedov > skype: kamedov    www: kamedov.ru -- You received this message because you are subscribed to the Google Groups "Django users" group.

Question about GenericRelation

2011-05-05 Thread Stodge
I have a Page model, with a generic foreign key. I have a Story model, which has a generic relation to Page. If I do: sp=StaticPage.objects.get(id=1) I have to do this to get the Page object: sp.content.all()[0] However, there will only ever be on Story linked to one Page model. Is there anyway

Overriding templates for the inclusion_tag

2011-05-12 Thread Stodge
Is there any interest in changing the inclusion template functionality to let the function return the template name in the dictionary to the inclusion_tag decorator? This would let the developer override the template filename: {{{ @register.inclusion_tag('block/render_region.html') def render_reg

Using generic_inlineformset_factory to inline a form for categories?

2011-05-13 Thread Stodge
I have the following models: class Category(models.Model): type = models.CharField(max_length=128) class CategoryTerm(models.Model): term = models.CharField(max_length=128) type = models.ForeignKey(Category, related_name='terms') class CategoryMap(models.Model): term = models.For

How to remember that I dynamically added a form to the form wizard?

2011-05-26 Thread Stodge
Quick form wizard question. I create my wizard with one form. When that one is submitted, I add a second form to the form list. This second form/step is displayed. When I submit this one, the wizard suddenly thinks it only has one form, not two. I realise that when I create the form wizard in my vi

Re: Limit number of concurrent non-admin/non-superuser users

2010-12-16 Thread Stodge
nough to ensure a user remains logged in. Typically with my site, requests are sent at least every minute to refresh displayed data. On Dec 10, 10:45 am, Daniel Roseman wrote: > On Dec 10, 3:07 pm, Stodge wrote: > > > > > > > > > > > I'm trying to limit

Login support for external applications?

2011-01-11 Thread Stodge
I need to let client applications, primarily written in Java and Python login to my Django site. What's the best way? Request the form, parse it and POST the username, password and csrf token? Or provide an Ajax login view? -- You received this message because you are subscribed to the Google G

Is there a way to know which user changed a particular model through the admin site?

2011-02-07 Thread Stodge
I need to know who changed a particular model through the admin site so I can create a log entry. The post_save signal has no knowledge of the user that changed the model and overriding the model's save method won't tell me the user either. Is there a way to know which user changed a particular

Is there any way to get the ip address of the user in the post_save signal?

2011-02-07 Thread Stodge
Is there any way to get the ip address of the user in the post_save signal? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to

SVG attribute is not transformed

2014-07-10 Thread Stodge
I'm adding map data from a new source that needs to be projected so I transform the query set like this: q = Polyline.objects.filter(overlay='63979e90-a578-4d18-af0a-8bd75279d923').transform(93997).svg() The resulting SVG attribute isn't transformed. The documentation says: Attaches a SVG at

Using Django as a centralised auth server?

2014-07-29 Thread Stodge
I have several Django websites and I want to create a centralized auth provider. The auth provider site would contain the user accounts and be the only repository for user details and passwords. Users would log into the auth provider site and when they visit each satellite website for the first

AppRegistryNotReady trying to access model's verbose name

2014-08-06 Thread Stodge
I'm trying to port my Django project to Dango 1.7rc2 but I'm hitting the app registry error. I know that this is mentioned in the Troubleshooting section of the documentation but I don't understand why this is happening. __init__.py", line 44, in register_layer layer['verbose_name'] = model.

Custom management commands provided as only .pyc files?

2014-08-12 Thread Stodge
As explained in https://code.djangoproject.com/ticket/14952, Django doesn't support custom management commands that are only provided as .pyc files. I have a requirement with my project that I cannot distribute the .py files - only the .pyc. It's a roundabout way of not providing the source code

Re: Custom management commands provided as only .pyc files?

2014-08-14 Thread Stodge
Thanks - there are some great suggestions here. Much appreciated. -- 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 p

Re: post_save doesn't work

2014-08-14 Thread Stodge
I've had good success with placing the import at the end of the models file. On Tuesday, 12 August 2014 20:06:41 UTC-4, chedi toueiti wrote: > > Hi Neto, > > Just make sure that your callback is loaded, the most easy way to do it is > to import the function in models.py if you have a single model

Auto generating API documentation for SoapLib 0.8 + Django?

2014-09-16 Thread Stodge
We implemented a simple SOAP service using SoapLib 0.8 in our Django project a long time ago. We think he created an API document that we want to send to clients. I have a vague recollection that he somehow auto-generated the APIs from the source code. However, we can't find the document and th

Retrieving recurring events using Django queries

2014-09-19 Thread Stodge
I have the following to model a calendar entry (recurring event). I need the ability to retrieve all events from the database between a start and end date. This has to include one off events and also recurring "virtual" events that occur because of an event in the database. Do you think this is

Re: Upgrading Django (to 1.7)

2014-10-02 Thread Stodge
I will read this thanks. Does it cover this issue? django.core.exceptions.AppRegistryNotReady: The translation infrastructure > cannot be initialized before the apps registry is ready. Check that you > don't make non-lazy gettext calls at import time. > I don't know if this has been a pain to m

How to use natural keys when dumping/loading fixture data for models that use generic relations?

2014-10-02 Thread Stodge
I'm trying to create fixtures for my Django application. We have our own app that provides per-object permissions. It uses a GenericForeignKey to assign permissions to many different models. I need the ability to define fixtures for these custom permissions. However, I'm having trouble understa

Dango signal can't delete directory

2014-11-06 Thread Stodge
I have a separate daemon running as root that generates cached image tiles per user for a map. For now it creates them under /tmp/tile_cache. When it creates a new tile cache it changes the UID and GID to the apache user (on Fedora) and also gives everyone access to the directory, e.g. permissio

Re: Dango signal can't delete directory

2014-11-06 Thread Stodge
I'll see if the python code under Apache can stat /tmp. Thanks. On Thursday, 6 November 2014 10:56:39 UTC-5, Tom Evans wrote: > > On Thu, Nov 6, 2014 at 3:54 PM, Tom Evans > wrote: > > On Thu, Nov 6, 2014 at 3:08 PM, Stodge > > wrote: > >> I have a s

Re: Dango signal can't delete directory

2014-11-06 Thread Stodge
I'm debug printing the directory I'm trying to delete, so I'm sure it's correct. But you raise a valid point! I also change permissions and ownership of /tmp/tile_cache. Thanks. On Thursday, 6 November 2014 10:59:35 UTC-5, Bruno Barcarol Guimarães wrote: > > > os.path.exists fails to see the di

Re: Dango signal can't delete directory

2014-11-06 Thread Stodge
root 1380 Nov 6 11:07 .. > drwxrwxrwx 2 apache apache 860 Nov 6 11:07 mike Oh but I just noticed that the total is '0'. Weird. On Thursday, 6 November 2014 11:02:15 UTC-5, Stodge wrote: > > I'll see if the python code under Apache can stat /tmp. Thanks. > > O

Re: Dango signal can't delete directory

2014-11-06 Thread Stodge
Tom, you might be right about the sticky bit. If I store the tile cache elsewhere, the signal can successfully delete it. On Thursday, 6 November 2014 10:55:03 UTC-5, Tom Evans wrote: > > On Thu, Nov 6, 2014 at 3:08 PM, Stodge > > wrote: > > I have a separate daemon ru

Re: Action without URL

2014-05-08 Thread Stodge
Yes it is possible - think of the actions that need to take place. * The user clicks the button in the browser. * The browser sends an Ajax request to Django * The Django view processes the Ajax request, updates the database and sends a response to the browser These are web fundamentals and I

Language code issue - Django thinks default is en-us?

2014-06-18 Thread Stodge
My settings for languages are: LANGUAGE_CODE = 'en' USE_I18N = True LANGUAGE_COOKIE_NAME='django_language' ugettext = lambda s: s LANGUAGES = ( ('en', ugettext('English')), ('de', ugettext('German')), ('fr', ugettext('French')) ) I have a post-save signal that creates instances of a

Re: Language code issue - Django thinks default is en-us?

2014-06-18 Thread Stodge
. On Wednesday, 18 June 2014 12:48:47 UTC-4, Stodge wrote: > > My settings for languages are: > > LANGUAGE_CODE = 'en' > > USE_I18N = True > LANGUAGE_COOKIE_NAME='django_language' > ugettext = lambda s: s > LANGUAGES = ( > ('en', ugettext(&#x

Re: Language code issue - Django thinks default is en-us?

2014-06-18 Thread Stodge
Even when I override the language code in my custom command get_language() still returns "en-us". Weird. Guess I'll have to use settings.LANGUAGE_CODE instead of get_language(). On Wednesday, 18 June 2014 13:02:37 UTC-4, Stodge wrote: > > Oh. > > > https://docs.

Re: Language code issue - Django thinks default is en-us?

2014-06-18 Thread Stodge
http://www.jetbrains.com/pycharm/ > "Develop with pleasure!" > > > >-Original Message- > >From: django...@googlegroups.com > >[mailto:django...@googlegroups.com ] On Behalf Of Stodge > >Sent: Wednesday, June 18, 2014 9:21 PM > >To: djan

Re: Language code issue - Django thinks default is en-us?

2014-06-18 Thread Stodge
jango IDE) > http://www.jetbrains.com/pycharm/ > "Develop with pleasure!" > > > >-Original Message- > >From: django...@googlegroups.com > >[mailto:django...@googlegroups.com ] On Behalf Of Stodge > >Sent: Wednesday, June 18, 2014 9:42 PM

Re: Language code issue - Django thinks default is en-us?

2014-06-18 Thread Stodge
nt command still returns "en-us". On Wednesday, 18 June 2014 13:58:05 UTC-4, James Bennett wrote: > > On Wed, Jun 18, 2014 at 10:21 AM, Stodge > > wrote: > >> Even when I override the language code in my custom command >> get_language() still

Re: Language code issue - Django thinks default is en-us?

2014-06-19 Thread Stodge
ing the functions provided by the I18N support code:* Using the code: # Activate a fixed locale, e.g. Russian translation.activate('ru') However, this doesn't appear to change anything. On Thursday, 19 June 2014 08:38:31 UTC-4, Tom Evans wrote: > > O

Re: Language code issue - Django thinks default is en-us?

2014-06-19 Thread Stodge
Sorry, this is using Django 1.6.2. On Wednesday, 18 June 2014 12:48:47 UTC-4, Stodge wrote: > > My settings for languages are: > > LANGUAGE_CODE = 'en' > > USE_I18N = True > LANGUAGE_COOKIE_NAME='django_language' > ugettext = lambda s: s &g

Re: Database problem in Django

2014-06-19 Thread Stodge
Read the documentation: https://docs.djangoproject.com/en/dev/ref/models/querysets/#order-by On Wednesday, 18 June 2014 08:06:18 UTC-4, Ashu Singh wrote: > > Hello everyone. My doubt is how to fetch the recent two database entries > in django. User may enter into database anytime but the query s

Re: Language code issue - Django thinks default is en-us?

2014-06-19 Thread Stodge
No that's the code from the Django documentation. https://docs.djangoproject.com/en/1.6/howto/custom-management-commands/#management-commands-and-locales On Thursday, 19 June 2014 09:39:34 UTC-4, Tom Evans wrote: > > On Thu, Jun 19, 2014 at 1:41 PM, Stodge > > wrote: > >

Re: Language code issue - Django thinks default is en-us?

2014-06-19 Thread Stodge
strap function calls loaddata management command (using management.call_command) * data created in DB, which triggers a post_save signal * get_language() in post_save signal always returns "en-us" On Wednesday, 18 June 2014 12:48:47 UTC-4, Stodge wrote: > > My settings for la

Using forms/template to enter recurring events - how to avoid duplicate and redundant forms?

2014-06-20 Thread Stodge
I'm trying to make a template and form to let a user define a recurring event. I want to present different fields depending on whether they want daily, weekly, monthly or yearly recurrence. I'm not sure how to define the forms to do this so that the submitted data isn't duplicated or redundant.

Re: Language code issue - Django thinks default is en-us?

2014-06-20 Thread Stodge
>> Examples: it, de_AT, es, pt_BR. The language part is always in lower >> case and the country part in upper case. The separator is an underscore. > > > so 'en-gb' should not be recognized. > 'en_GB' ought to be. > > > On Thursday, June 19,

How to filter generic foreign keys?

2014-06-21 Thread Stodge
I have these models: class EventEntry(models.Model): content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey('content_type', 'object_id') start_date = models.DateTimeField(...) end_date = models.DateTim

Unable to use custom StaticFilesStorage

2017-11-01 Thread Stodge
I'm trying to add an extra directory for each app that will contain Javascript/CSS files. I created a custom storage.py in my app containing a copy of the code from Django's AppDirectoriesFinder class, but I changed source_dir from "static" to "catalog". I'll include the Django code with the mo

Re: Unable to use custom StaticFilesStorage

2017-11-01 Thread Stodge
): super(CatalogFinder, self).__init__(*args, **kwargs) STATICFILES_FINDERS = ( "django.contrib.staticfiles.finders.FileSystemFinder", "django.contrib.staticfiles.finders.AppDirectoriesFinder", "myapp.finders.CatalogFinder" ) On Wednesday, 1 Novemb

Re: Unable to use custom StaticFilesStorage

2017-11-02 Thread Stodge
There's a flaw in my plan as STATICFILES_STORAGE is a string and not a tuple. -- 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...@googlegr

Let the model define the database with a custom router

2017-12-15 Thread Stodge
I'm porting a website from Django 1.6.x to 1.11 and I'm hitting a problem with my custom router. Some models define a custom attribute defining which database it will reside in: class MyModel(models.Model): DATABASE_NAME = "foo" This worked in our custom router in 1.6.x but not in 1.11. The

Are URL namespaces optional or are they used by default by Django?

2017-12-21 Thread Stodge
I am porting an app from Django 1.6.x to 1.10.x and I'm hitting a problem with URL namespaces. I don't specifically configure any namespaces in my URLs but Django seems to think that all my app URLs are namespaced. The documentation seems to imply that namespaces are optional and only configure

Re: Are URL namespaces optional or are they used by default by Django?

2017-12-21 Thread Stodge
y optional - you don't have to use it if you don't > want to. > > What is happening that makes you think otherwise? What errors are you > seeing? > > Regards, > > Andréas > > 2017-12-21 16:38 GMT+01:00 Stodge >: > >> I am porting an app from D

Re: Are URL namespaces optional or are they used by default by Django?

2017-12-21 Thread Stodge
e I'm not using the namespace parameter on include()? On Thursday, 21 December 2017 10:38:36 UTC-5, Stodge wrote: > > I am porting an app from Django 1.6.x to 1.10.x and I'm hitting a problem > with URL namespaces. I don't specifically configure any namespaces in my >

Re: Are URL namespaces optional or are they used by default by Django?

2017-12-21 Thread Stodge
the namespace in the call to reserve, so if you had setup the > namespace like i wrote here, you would use: > reverse("license:license_detail", args=(1, )) > > Hope I have explained it good enough :-) > > Regards, > > Andréas > > 2017-

Re: Are URL namespaces optional or are they used by default by Django?

2018-01-10 Thread Stodge
Problem solved and apparently it was my silly mistake! While experimenting I added app_name to my urls files. Apparently this enables namespace support. So I removed them from my urls files and it works. Thanks On Thursday, 21 December 2017 10:38:36 UTC-5, Stodge wrote: > > I am porting

Suggestions for using a custom pre-login signal to perform custom validation?

2018-03-16 Thread Stodge
I want to add a custom pre-login signal (user_logging_in) that fires just before Django's login function is called. This is a snippet from our custom account app that may explain what I want: from django.contrib.auth import login as real_login def custom_login() # Allow other apps to per

Any way to force Django to commit a write so another process can read the correct data from DB?

2016-07-27 Thread Stodge
My website uses a combination of Django + Java apps to function. For this particular problem, a record is deleted from the DB via a TastyPie resource DELETE operation. A Django signal post_delete handleris invoked, which submits a DELETE request to Jetty running in the Java app. The Java app th

Signal handling when deleting lots of objects?

2016-09-01 Thread Stodge
I have two models, Volume and Group. The Volume model has a foreign key to Group. When a user deletes a Volume the post_delete signal handler sends an HTTP DELETE request (/volume) to another server process. This works great. However, when the user deletes a Group, the cascading delete also del

Re: Signal handling when deleting lots of objects?

2016-09-01 Thread Stodge
Thanks Erik. I forgot to say that the Group model has an "active" flag on it, so I'm seeing if I can use this. On Thursday, 1 September 2016 14:55:05 UTC-4, Erik Cederstrand wrote: > > > > Den 1. sep. 2016 kl. 20.14 skrev Stodge >: > > > > > I

How to get Django to log all uncaught exceptions?

2016-09-02 Thread Stodge
I'm getting an exception during a TastyPie request for one of my resources. The exception is: Error: not all arguments converted during string formatting I know what causes the exception, but I have no idea where it is happening, as there is no trackback or indication of which module or functio

Re: How to get Django to log all uncaught exceptions?

2016-09-02 Thread Stodge
Ok, so I discovered after searching through lots of code that the problem occurs because I haven't run compilemessages, so Django was trying to format an error message that accepted parameters. On Friday, 2 September 2016 11:06:58 UTC-4, Stodge wrote: > > I'm getting an ex

Visiting one Django server logs me out of another Django server, both behind the same proxy

2016-09-29 Thread Stodge
I have two Django servers A1 and S1, which sit behind a simplistic NodeJS proxy. This is a silly attempt at single sign on. I can log into and out of A1 (authentication server) just fine. If I log into A1, visit S1 (without being logged in to S1) and then revisit A1, I am no longer logged in. T

Re: Visiting one Django server logs me out of another Django server, both behind the same proxy

2016-09-30 Thread Stodge
rmal So the user is logged into both. It's a fairly naive attempt at reinventing the wheel, but that's how we learn, right? :) Cheers Mike On Friday, 30 September 2016 04:30:04 UTC-4, Michal Petrucha wrote: > > On Thu, Sep 29, 2016 at 01:50:22PM -0700, Stodge wrote: > >

Re: Visiting one Django server logs me out of another Django server, both behind the same proxy

2016-09-30 Thread Stodge
I discovered JSON Web Tokens after I posted my original question. So I'll read about how they work. Thanks Mike On Thursday, 29 September 2016 16:50:22 UTC-4, Stodge wrote: > > I have two Django servers A1 and S1, which sit behind a simplistic NodeJS > proxy. This is a silly att

Re: Visiting one Django server logs me out of another Django server, both behind the same proxy

2016-09-30 Thread Stodge
Thanks again. I set a different session cookie name for S1 and it seems to have worked. -- 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...

Get the maximum possible ID value for a primary key?

2019-01-09 Thread Stodge
Is there a way to get the maximum value that an ID can be for a model that uses AutoField for its primary key? For example, in PostgreSQL I could do: SELECT maximum_value FROM information_schema.sequences WHERE sequence_name = 'my_sequence_id_seq'; maximum_value --- 9 (1 row)

How to know when a record is added to or removed from a many to many relationship?

2017-06-13 Thread Stodge
I have a model with a many to many relationship. I need to know when a record is added to or removed from the many to many. Is this possible? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiv

Re: How to know when a record is added to or removed from a many to many relationship?

2017-06-13 Thread Stodge
when a > record is added or removed. > > Nevertheless, you can make use of django signals (Thanks to melvyn). It > will be of great help. > > Yingi Kem > > On 13 Jun 2017, at 12:54 PM, Stodge > > wrote: > > I have a model with a many to many relationship. I ne

Managing and synchronising users on multiple sites

2015-11-08 Thread Stodge
I have several Django sites and I need to synchronize user accounts across them all. I need the ability to create the same user on all sites at the same time and also to keep their info in sync. The servers are in different locations in DMZs and can't open connections to external servers. So no

Re: Managing and synchronising users on multiple sites

2015-11-08 Thread Stodge
, > the site authenticates them against the SSO, and fetches user data. See Stack > Exchange sites (Stack Overflow, Server Fault, etc) as an example. > > On 8 Nov 2015 18:24, "Stodge" wrote: > I have several Django sites and I need to synchronize user accounts across > them a

Django imports models for apps that aren't enabled?

2016-01-05 Thread Stodge
I'm using Django 1.6.9. When the dev server (and hence Apache) starts, is Django supposed to import models for apps that exist on disk, but aren't enabled in the settings? I'm seeing this behaviour and I wasn't expecting it. Thanks -- You received this message because you are subscribed to the

Re: Django imports models for apps that aren't enabled?

2016-01-05 Thread Stodge
Carl, thanks. You were right - I was experiencing "b". Thanks again Mike On Tuesday, 5 January 2016 11:02:24 UTC-5, Carl Meyer wrote: > > Hi Stodge, > > On 01/05/2016 08:57 AM, Stodge wrote: > > I'm using Django 1.6.9. When the dev server (and hence Apache) s

Session recycling during login times out

2016-02-27 Thread Stodge
I'm trying to diagnose a problem where noone can login to my django site. The login attempt times out as NGINX (proxy) gives up waiting for Apache to respond. There are no errors in the logs anywhere. I copied the Django code into my app to debug: def this_real_login(request, user): > """ >

Re: Session recycling during login times out

2016-02-27 Thread Stodge
The title is misleading; it should probably be "Session recycling stalls during login". I also noticed that logout stalls. On Saturday, February 27, 2016 at 3:12:08 PM UTC-5, Stodge wrote: > > I'm trying to diagnose a problem where noone can login to my django site. >

Django app that adds multiple inheritance for Django auth groups?

2016-04-01 Thread Stodge
Is anyone aware of a Django app that adds multiple inheritance to Django auth groups? I know about django-hierarchical-auth but I want the ability to specify multiple parents for a group to make it easier to manage and group permissions. Thanks -- You received this message because you are subs

Using reflection with Django models to determine module containing the choices?

2018-12-10 Thread Stodge
Let's say I take the following code from the Django documentatation: class Student(models.Model): FRESHMAN = 'FR' SOPHOMORE = 'SO' JUNIOR = 'JR' SENIOR = 'SR' YEAR_IN_SCHOOL_CHOICES = ( (FRESHMAN, 'Freshman'), (SOPHOMORE, 'Sophom

Re: Using reflection with Django models to determine module containing the choices?

2018-12-10 Thread Stodge
he ones > likely to define choices) and use the `is` operator to compare all > of them to the field choices. > > This will perform badly and shouldn't be used for anything else > than one off debugging reflection though. > > Best, > Simon > > Le lundi 10 décembre 2

<    1   2