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

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

2018-12-10 Thread Stodge
> 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 2018 10:33:35 UT

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,

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

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

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

2017-12-21 Thread Stodge
here, you would use: > reverse("license:license_detail", args=(1, )) > > Hope I have explained it good enough :-) > > Regards, > > Andréas > > 2017-12-21 17:02 GMT+01:00 Stodge <sto...@gmail.com >: > >> I am using a prefix when I include the

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

2017-12-21 Thread Stodge
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 > URLs but Django seems to think

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

2017-12-21 Thread Stodge
- 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 <sto...@gmail.com >: > >> I am porting an

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

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.

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

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

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

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

2017-06-13 Thread Stodge
w 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 <sto...@gmail.com > > wrote: > > I have a model with a many to many

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

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

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 attempt

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

2016-09-30 Thread Stodge
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: > > I have two Django servers A1 a

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.

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 exception

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

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 <sto...@gmail.com >: > >

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

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

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

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. > The

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: 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) sta

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

Re: Managing and synchronising users on multiple sites

2015-11-08 Thread Stodge
e 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" <sto...@gmail.com> wrote: > I have several Django sites and I need to synchronize user accounts acro

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: 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 <sto...@gmail.com > > wrote: > > I have a se

Re: Dango signal can't delete directory

2014-11-06 Thread Stodge
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. > > On Thursday, 6 November 2014 10:56:3

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

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 <teva...@googlemail.com > > wrote: > > On Thu, Nov 6, 2014 at 3:08 PM, Stodge <sto...@gmail.com

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.

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

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

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

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

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

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

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

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'] =

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

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

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 =

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, 2014 3:18:32 PM UTC+1, St

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-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

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 <sto...@gmail.com > >

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 > LANGUAGES = ( >

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

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

2014-06-19 Thread Stodge
he 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: > > On Wed, Jun 18, 2014 at 7:

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 <sto...@gmail.com > > wrote: > >> Even when I override the language code in my custom command >> get_language() st

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

2014-06-18 Thread Stodge
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
> > > >-Original Message- > >From: django...@googlegroups.com > >[mailto:django...@googlegroups.com ] On Behalf Of Stodge > >Sent: Wednesday, June 18, 2014 9:21 PM > >To: django...@googlegroups.com > >Subject: Re: Language code issue - Django

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.djang

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('English')), > ('de', ugettext(

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

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

Location of non-app-specific static files?

2012-11-04 Thread Stodge
I have two project static directories, STATIC and STATIC_FILES. STATIC contains non-app specific static files. STATIC_FILES is where static files are "collected". -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the

Permissions and the sites framework

2012-11-04 Thread Stodge
Are there any plans to change the Permissions to use the sites framework? To support multi-site on my site, I need the ability to assign different permissions to the same user on different sites. Alternatively, any suggestions how to achieve this? Thanks -- You received this message because

How to make my custom AdminSite class use my custom login/logout views?

2012-09-06 Thread Stodge
I have a custom AdminSite class working but now I'm trying to work out the best way to make it use my custom login and logout views. I supposed I could copy chunks of code from Django's admin sites.py and make it use my views. But this is a hack. Is there a standard way of using custom

Do I create an instance of my custom AdminSite in every admin.py?

2012-09-06 Thread Stodge
I'm experimenting with creating a custom admin site but I'm confused about something. Do I create an instance of my admin site in every admin.py or do I only create a single instance somewhere, and if so, where? Thanks -- You received this message because you are subscribed to the Google

Re: call_command('syncdb') in virtualenv failing: Error: No module named staticfiles

2012-04-23 Thread Stodge
Bah - I completely forgot that my gen.py script had this : #!/usr/bin/python On Monday, 23 April 2012 07:26:55 UTC-5, Stodge wrote: > > I'm trying to port an existing app to Django 1.4 so I'm using virtualenv. > ./manage.py syncdb works but my old script that calls syncdb and creates

call_command('syncdb') in virtualenv failing: Error: No module named staticfiles

2012-04-23 Thread Stodge
I'm trying to port an existing app to Django 1.4 so I'm using virtualenv. ./manage.py syncdb works but my old script that calls syncdb and creates dummy data doesn't. My code: os.environ["DJANGO_SETTINGS_MODULE"]="settings" call_command('syncdb', interactive=False) is giving: Error: No module

Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Stodge
All good points thanks. I'm only experimenting and learning so this won't hit production. Point taken though. :) On Mar 22, 7:30 am, Tom Evans <tevans...@googlemail.com> wrote: > On Thu, Mar 22, 2012 at 12:25 PM, Stodge <sto...@gmail.com> wrote: > > No I need MEDIA_ROOT,

Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Stodge
No I need MEDIA_ROOT, I want to experiment with: Thanks On Mar 22, 7:22 am, kenneth gonsalves <law...@thenilgiris.com> wrote: > On Thu, 2012-03-22 at 05:11 -0700, Stodge wrote: > > In my template: > > > MEDIA_ROOT: {{MEDIA_ROOT}} > > > But all I see is: >

Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Stodge
Oh that's surprising; the media context processor only creates MEDIA_URL. On Mar 22, 7:11 am, Stodge <sto...@gmail.com> wrote: > I'm trying to reference MEDIA_ROOT in my template but it's blank. I > have MEDIA_ROOT defined in settings.py: > > MEDIA_ROOT = os.path.jo

Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Stodge
I'm trying to reference MEDIA_ROOT in my template but it's blank. I have MEDIA_ROOT defined in settings.py: MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'static') I have the correct context processor: TEMPLATE_CONTEXT_PROCESSOR = (

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 <tevans...@googlemail.com> wrote: > On Wed, Jan 18, 2012 at 1:50 PM, Stodge <sto...@gmail.com> wrote: > > I have a particular use case where the default permissions don't work > > for me. I know I can c

Any way to not create default Django permissions?

2012-01-18 Thread Stodge
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, is there a clean, legal way to not create the default model permissions? Thanks -- You received this message because you are subscribed to the Google Groups

One To One relationship with a generic relation?

2012-01-14 Thread Stodge
I've used generic relations and they worked, but in one particular case I need a one-to-one generic relation. Is this possible? -- 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.

Django pub/sub with filtering?

2012-01-09 Thread Stodge
I'm trying to design a pub/sub event system for my site. The inputs will be Django signals (e.g. User logged in), views and external POST requests. I can easily create subscriptions: Event type, e.g. Auth.login Instance, e.g. User object for Fred Data, nothing for this example User, subscribing

Re: Logging into CSRF protected Django site using Curl?

2012-01-08 Thread Stodge
Thanks, appreciate it. On Jan 8, 12:16 pm, creecode <creec...@gmail.com> wrote: > Hello Stodge, > > It seems a bit convoluted on the command line but in reallity not much more > convoluted if you consider all that a browser does for us in this regard. > :-) > > I'

Re: Authentication over JSON

2012-01-08 Thread Stodge
This link is giving me a Page Not Found. On Jan 7, 1:10 pm, Michael Elkins wrote: > On Sat, Jan 07, 2012 at 11:52:26AM -0500, Kevin Anthony wrote: > >I have a small exposed json API, currently it doesn't require > >authentication, but i'd like to integrate it with django's

Logging into CSRF protected Django site using Curl?

2012-01-08 Thread Stodge
I want to log in to my Django app using something like curl. I know that I could send a GET to get the login form and the CSRF token and then submit a POST with the username, password and CSRF token. But this seems awfully convoluted. Is this the only to login to a Django site that uses CSRF

Duplicate translation strings in project/app1/locale and project/locale

2011-12-16 Thread Stodge
I'm reworking my translations, but I'm having a problem with duplicate strings. I'm running make messages in the project directory and also in each applications's directory, I'm seeing strings used in an application (found in project/app1/locale) duplicated in project/ locale. This seems counter

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

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 =

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

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

Re: django-cas-consumer template question

2011-04-29 Thread Stodge
gin. Login form is shown on service with django-cas-provider. > > On Fri, Apr 29, 2011 at 7:30 PM, Stodge <sto...@gmail.com> wrote: > > django-cas-consumer > > -- > Alex Kamedov > skype: kamedov    www: kamedov.ru -- You received this message because you are subscrib

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

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

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

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

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

2010-12-16 Thread Stodge
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 <dan...@roseman.org.uk> wrote: > On Dec 10, 3:07 pm, Stodge <sto...@gmail.com> wrote: > > > > > &

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

2010-12-10 Thread Stodge
I'm trying to limit the number of concurrent users attached to my Django website. For example I need to implement a floating license system. I've seen a few snippets but so far I think they all implement a middleware. I'm trying to avoid using a middleware because I don't want the overhead on

Re: SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed?

2010-12-10 Thread Stodge
Ok thanks. I'm trying to limit the number of concurrent users using sessions. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to

SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed?

2010-12-10 Thread Stodge
I have SESSION_EXPIRE_AT_BROWSER_CLOSE set to True in my settings. When the user visits my custom login page a new session is created for them in the database. The expiry time is set to two weeks. If I then close the browser, the expiry hour/minute are adjusted but it's still set to two weeks in

Re: Multiple database issue v1.2.3 - Django reading the wrong database

2010-10-26 Thread Stodge
6/site-packages/django/db/backends/ postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args) DatabaseError: relation "scene" does not exist LINE 1: ...le", "scene"."datasets", "scene"."transform" FROM &quo

Multiple database issue v1.2.3 - Django reading the wrong database

2010-10-26 Thread Stodge
I have two PostgreSQL (postgresql_psycopg2) databases defined in my settings; default and scenes. If I perform a filter using the 'scenes' DB I get the expected results: Scene.objects.filter(name__contains='ME').using('scenes') [, ] If I perform a get(), Django seems to get completely confused

Re: Delete the FileField record but keep the file?

2010-10-14 Thread Stodge
That's basically all I've done unless I can find a cleaner solution. I copy the files elsewhere, delete the records and then copy the files back. On Oct 13, 2:13?am, Jonathan Barratt wrote: > On 12 ?.?. 2010, at 22:42,Stodgewrote: > > > Short of creating my own

Delete the FileField record but keep the file?

2010-10-12 Thread Stodge
Short of creating my own custom FileField class, is there anyway to pass an optional "delete" flag to a custom file system storage? I have a case where I want to delete the FileField record, but not the file. -- You received this message because you are subscribed to the Google Groups "Django

Problem with FileField and FileSystemStorage and upload_to

2010-10-06 Thread Stodge
I'm trying to use the FileField with a custom FileSystemStorage class. I have my location and upload_to set: location = /opt/files/ upload_to = mike I want files to upload to /opt/files/mike but the filenames are prefixed in the database with /mike, which I don't want. So based on the docs I

Re: What's the best way to implement project permissions in a project management app?

2010-10-05 Thread Stodge
t; > This approach will give you per-project permissions like you > requested. > > On Oct 5, 5:23 am, Stodge <sto...@gmail.com> wrote: > > > > > That looks like what I need. Thanks. Though I also need per-project > > permissions; so user 'bob' can access tic

Re: What's the best way to implement project permissions in a project management app?

2010-10-05 Thread Stodge
;mi...@dewhirst.com.au> wrote: > On 5/10/2010 11:32am, Stodge wrote: > > >   What's the best way to implement project permissions in a project > > management app? Should I just create the concept of membership and > > have a function is_member on the project model? > >

What's the best way to implement project permissions in a project management app?

2010-10-04 Thread Stodge
What's the best way to implement project permissions in a project management app? Should I just create the concept of membership and have a function is_member on the project model? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

  1   2   >