Re: SESSION_COOKIE_DOMAIN on multiple domains.

2013-08-01 Thread J. Cliff Dyer
> > master site. > > > > > > - Cookie needs to be set only once. When session (on any site) is > > > invalid, the other sites will notice that and automatically > generates > > > new session key. > > > > > > Another

Re: SESSION_COOKIE_DOMAIN on multiple domains.

2013-08-01 Thread J. Cliff Dyer
could share the code, if you were interested. It isn't published > anywhere yet. > > > Cheers, > Tom > > Dne Thu, 1 Aug 2013 06:41:20 -0700 (PDT) > "J. Cliff Dyer" <j...@sdf.lonestar.org > napsal(a): > > > Is there a way to set the SESS

SESSION_COOKIE_DOMAIN on multiple domains.

2013-08-01 Thread J. Cliff Dyer
Is there a way to set the SESSION_COOKIE_DOMAIN for multiple domains, possibly using the contrib.sites framework? We deploy on AWS, and when we roll out an update to one of our site, we first create a new cloudformation stack, and attach a domain name to it like

Re: Avoiding code repetition in views

2012-06-28 Thread J. Cliff Dyer
It looks like what you want to do is create a templatetag. Then you can just include a snippet like: {% gig_schedule %} in your template. The documentation can point you in the right direction. On Thu, 2012-06-28 at 15:20 -0700, grimmus wrote: > Hi, > > > I am doing a site for a DJ that lists

Re: Problem with the tutorial.

2012-04-05 Thread J. Cliff Dyer
You might be overriding the DATABASES setting later on in your settings file, or you might not be accessing the settings file you think you're accessing. Try running the following, to see what value you get: $ python manage.py shell >>> from django.conf import settings >>> settings.DATABASES [?]

Re: Djano if statement help

2012-03-16 Thread J. Cliff Dyer
Well the first suspicious thing was that you were testing to see if it was equal to the string "0". That tells me you don't understand how equality works in python. Python is strongly typed. Strings and integers are not the same thing, and will never be equal to one another. Without more

Re: could i use a select?

2012-02-08 Thread J. Cliff Dyer
On Wed, 2012-02-08 at 09:53 -0500, Dennis Lee Bieber wrote: > On Tue, 7 Feb 2012 21:23:58 -0800 (PST), akaariai > wrote: > > >I think you could do > >Customer.objects.annotate(tot_invoice=Sum(invoice_set__total_invoice)).order_by('tot_invoice') > >[0:10]. > > NOTE: the

Re: Help Me With This Form

2012-01-24 Thread J. Cliff Dyer
Your view doesn't pass a context to the template. It needs to do this, and your form needs to be part of the context. something like: from myweb.meekapp.models import mobForm from django.shortcuts import render_to_response from django.template import RequestContext def home(request):

Re: url name to generic class-based views with parameters?

2012-01-18 Thread J. Cliff Dyer
You need to use {% url videos video.id %} or {% url videos pk=video.id %} On Wed, 2012-01-18 at 07:46 -0800, Mark Stahler wrote: > Can someone explain how to link using url names to class-based views > that include parameters? > > Example: > > url(r'^video/(?P\d+)/$', VideoView.as_view()), >

Re: reverse() with keyword argument driving me batty

2012-01-12 Thread J. Cliff Dyer
Your URLconf is broken. The (?P) regex fragment gives you a keyword argument of jobkey, but it only matches a zero length string. You need to include a regex to specify what you want jobkey to match. (?P[0-9a-fA-F]*) Cheers, Cliff On Thu, 2012-01-12 at 09:50 -0800, John DeRosa wrote: > Hi

Re: Please help me with django form 2.

2012-01-11 Thread J. Cliff Dyer
On Tue, 2012-01-10 at 23:49 -0800, coded kid wrote: > Hi guys, whenever I signup for my django form, my database is only > saving the id no and not names, username, email etc. | #sorry for > posting it like this. I'm on mobile. Okay. In my views.py, this ( | ) > means next line.

Re: UnicodeDecodeError

2012-01-05 Thread J. Cliff Dyer
Your problem is the curly quotes around “Times New Roman”. First, they will prevent CSS from seeing the font as Times New Roman, and second, they are encoded with the byte 0x93, which is how they show up in the various Windows code pages (cp1252, for instance). Convert your file to UTF-8, if you

Re: Pagination in ListView

2012-01-04 Thread J. Cliff Dyer
I've certainly seen blogs where I wished I could paginate negatively, where -1 would be the last page, -2 the second to last and so on. I was trying to work my way through a blog's archives from the beginning, but they kept adding new posts, so I never knew if the page I left off on was the page

Re: Can I escape or delimit the "{{ }}" template braces?

2011-12-19 Thread J. Cliff Dyer
The answer you're looking for is the "templatetag" template tag. Essentially, it lets you specify escaped characters by name. https://docs.djangoproject.com/en/dev/ref/templates/builtins/#templatetag For example: >>> from django.template import Template, Context >>> t = Template('{%

Re: User form creation from frontend?

2011-11-03 Thread J. Cliff Dyer
This is readily done in Django, but it will require you to handle the logic involved. You will need to create a view that shows a data entry form to the user to create the quiz and processes the data that is submitted, and then to create another view where students see the homework questions

Re: Set of choices of which several can be chosen without using a ManyToManyField

2011-11-01 Thread J. Cliff Dyer
On 11/01/2011 09:05 AM, Jaroslav Dobrek wrote: You are confusing model fields with form fields. MultipleChoiceField is a form field, not a model field. I wasn't aware of the existence of MultipleChoiceFields. The idea of the above code was to express that I wanted to use this code class

Re: Parsing a reStructuredText

2011-10-25 Thread J. Cliff Dyer
On 10/25/2011 11:34 AM, eaman wrote: I'm developing a web site in django to manage guides / howtos that I've been writing in reStructuredText. I'd like to display each section of them in a single page, how can I parse the reStructuredText to get titles / context of single sections? What have

Re: manage.py --settings breaks IPython

2011-10-19 Thread J. Cliff Dyer
On 10/19/2011 12:56 PM, h3 wrote: Doesn't work.. Error: Usage is runserver [optional port number, or ipaddr:port] And if I do the opposite: $: python manage.py runserver --settings=settings_dev -- Same problem comes back. On Oct 19, 12:52 pm, James Pyrich wrote: It

Re: Error handeling with Try

2011-10-19 Thread J. Cliff Dyer
On 10/19/2011 10:49 AM, Guy Nesher wrote: I have an odd problem tracking errors in a for loop I assign a loop counter to each error and print them at the end of the loop, but all the errors are numbered to the last iteration. The code goes something like this : error = [0,[]] counter =

Re: Testing: create db from scratch not working

2011-09-22 Thread J. Cliff Dyer
Try putting manouche at the bottom of your installed apps list. It looks like it depends on the site app being installed, but when django loads the manouche.models file, it hasn't loaded sites yet. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. Leonardo Giordani

Re: Postgres array datatypes equivalent in django models

2011-09-19 Thread J. Cliff Dyer
Sorry. The link for that project is https://github.com/ecometrica/django-dbarray Cheers, Cliff On Mon, 2011-09-19 at 11:15 -0400, J. Cliff Dyer wrote: > You might want to look into django-dbarray on github. It seems to add > support for postgresql array fields. > > I haven't us

Re: Using Postgress array types???

2011-09-19 Thread J. Cliff Dyer
Do you work with Kabir Kukreti? He just asked the same question. Look for my answer on that thread. Cheers, Cliff On Mon, 2011-09-19 at 05:01 -0700, Arihant wrote: > How can i store Postgress array types in Django models > -- You received this message because you are subscribed to the

Re: Postgres array datatypes equivalent in django models

2011-09-19 Thread J. Cliff Dyer
You might want to look into django-dbarray on github. It seems to add support for postgresql array fields. I haven't used it before, but it looks like you just need to do: from django.db import model import dbarray class TestRun(models.Model): function =

Re: Caching static images using memcache/nginx

2011-09-15 Thread J. Cliff Dyer
What is your goal in doing this? You are unlikely to see any performance gains from this effort. It won't render any faster for your users. Sending bytes over the network is far slower than reading them off disk, so it's not likely to be a bottleneck in terms of page loading. Your filesystem

Re: Validator for \t

2010-11-08 Thread J. Cliff Dyer
On Mon, 2010-11-08 at 12:21 -0800, Ralf wrote: > Hi, > > my users put values like 'Paul\t\t' per copy and paste into html- > formfields and suceeded, the values ended up in the database. > I wonder whether there is no build-in-validator to prevent these kind > of invalid input. > > Is there a

Re: Help with Geodjango+Postgres to find a Point, variance in decimal places

2010-08-25 Thread J. Cliff Dyer
Is one server 32 bit, while the other is 64 bit? It may be that on the old server, your representations of the number were precise enough to be identical, but on the new server, there is enough precision in the database to represent different numbers. "Reinout van Rees"

Re: Python question about subprocess.Popen() and stdout

2010-08-10 Thread J. Cliff Dyer
On Fri, 2010-08-06 at 18:35 -0100, Joshua Russo wrote: > > > Nope, still no dice. Below is what I did. I modified the worker() > function from one of the Stackoverflow examples. Let me know if I'm > using flush properly. Keep in mind that everything you see here is > already running in a

Re: Python question about subprocess.Popen() and stdout

2010-08-06 Thread J. Cliff Dyer
"Joshua Russo" wrote: >On Thu, Aug 5, 2010 at 10:53 PM, Steve Holden wrote: > >> On 8/5/2010 7:16 PM, Joshua Russo wrote: >> > On Aug 4, 6:49 pm, Hassan wrote: >> >>> Ok, so it appears that (in Python 2.5 at least) there is

Integrity error during syncdb with multidb.

2010-05-27 Thread J. Cliff Dyer
Hey all, I'm trying to set up django 1.2 to work with database replication in MySQL. When I run syncdb, I get an integrity error when content_types starts creating its data. Replication seems to be occurring, so I suspect I'm doing something wrong with my routing. Is there some gotcha I'm

Re: how to avoid "in" query for large sets?

2010-05-24 Thread J. Cliff Dyer
I believe you're confused. Your reply is to Tomasz, not to me. Also, my solution requires no model changes. Go back and look at it again. Cheers, Cliff On Mon, 2010-05-24 at 06:58 -0700, omat wrote: > @cliff: you are right, but i am writing an extension to an existing > app. i want to use

Re: how to avoid "in" query for large sets?

2010-05-24 Thread J. Cliff Dyer
What you are doing is querying the database once for each user to get their ID, because of your q.user.id. This means a million separate queries. You will be better off getting the id directly off the quiz table: User.objects.filter(id__in=[q.user_id for q in Quiz.objects.filter(score__gt=90)])

Re: Trouble with multi-db test suite.

2010-05-12 Thread J. Cliff Dyer
On Wed, 2010-05-05 at 08:08 +0800, Russell Keith-Magee wrote: > On Wed, May 5, 2010 at 1:43 AM, J. Cliff Dyer <j...@sdf.lonestar.org> wrote: > > I'm having trouble working with multi-db using mysql replication. When > > I run our test suite, I'm getting several hundred

Trouble with multi-db test suite.

2010-05-04 Thread J. Cliff Dyer
I'm having trouble working with multi-db using mysql replication. When I run our test suite, I'm getting several hundred errors if I have more than one database configured, and none if I have only one configured. It seems that something isn't getting properly cleared out between test cases, so

Re: download file

2009-09-22 Thread J. Cliff Dyer
ut open > > it how i > > can proceed. > > > > Thanks > > > > Luca > > > > On 22 Set, 09:02, luca72 <lucabe...@libero.it> wrote: > > > > > Thanks I use cherry py because i don't know how to download file with > > > django, ca

Re: Mutually exclusive fields in model validation

2009-09-15 Thread J. Cliff Dyer
Override the save method on your model, something like: class MyModel(models.Model): field1 = models.TextField(blank=True) field2 = models.TextField(blank=True) def save(self): if (self.field1 and self.field2): raise ModelValidationError, "only one can live"

Re: download file

2009-09-14 Thread J. Cliff Dyer
On Mon, 2009-09-14 at 07:57 -0700, luca72 wrote: > Hello i have try with cherrypy but i get this error: > > def scarico(request, id): > from cherrypy.lib.static import serve_file > fil_da_scar = F_d.objects.get(pk=id) > nome_file = fil_da_scar.nome_fil > return

Re: Parsing / Deserializing a JSON String

2009-09-03 Thread J. Cliff Dyer
I suspect your error is hiding in . What do you expect obj to be? Your JSON should return a big dictionary with one key ("ganttgroups"). When you iterate over a dictionary in python, you get the keys of that dictionary. In this case, the string "ganttgroups". You may be doing the following:

Re: Image Location

2009-08-23 Thread J. Cliff Dyer
On Sun, 2009-08-23 at 06:54 -0700, When ideas fail wrote: > Hello, i'm having a problem getting images to display so I was > wondering if someone would be kind enough to help? > > I have my settings.py set up as follows (content is the folder where > my static images are stored): > > MEDIA_ROOT

Running test suite without CREATE permission.

2009-08-19 Thread J. Cliff Dyer
When running a test suite, django starts by creating a test database. I am trying to run it on a webfaction account, and I can create an extra database through the site's control panel, but I can't give django permission to create one. Is there a way to get django to use a pre-existing database

Re: Using fixtures in tests

2009-08-17 Thread J. Cliff Dyer
On Mon, 2009-08-17 at 11:10 -0400, Marek Wawrzyczek wrote: > Hi, > > > I've got an application called myapp > > In the main folder of django project there is initial_data.json file > containing initial data for the application > I also have file "simplefix.json" situated in myapp/fixtures >

Re: how much python do i need to know to learn/use Django?

2009-08-14 Thread J. Cliff Dyer
On Fri, 2009-08-14 at 08:30 -0700, snfctech wrote: > Thanks for all the helpful replies, django-users group! > > I've got: > > - Java and C++ coursework > - a little professional Java, Perl and Tcl/Tk experience (off and on > over several years) > - 1 year large Servoy project (like a Java

Re: Portal Apps

2009-08-14 Thread J. Cliff Dyer
Yes. That is a fair assumption. On Fri, 2009-08-14 at 10:09 -0400, Joshua Williams wrote: > Quick question in regards to building portable apps: Should an > application rely on the app being on the PYTHONPATH to work properly? > That is, is having a app directory on the PYTHONPATH so

Re: import problem

2009-08-09 Thread J. Cliff Dyer
On Sun, 2009-08-09 at 11:59 -0700, Léon Dignòn wrote: > In my myproject/urls.py I want to pass the class to a function. > Because my urls.py is full of imports, I do not want another import > line for this class I only use at one line, because it's easier to > read. > > I wonder that I have to

Re: 1 template and multiple views?

2009-08-01 Thread J. Cliff Dyer
On Sat, 2009-08-01 at 18:35 +0200, Daniel Svonava wrote: > Hi, > > I have a simple question regarding Django template system. > > Lets imagine I have two blocks defined in my base template like this: > > Search bar > {% block A %} > {% endblock %} > > Content > {% block B %} > {% endblock %}

Unit testing views.

2009-07-09 Thread J. Cliff Dyer
I'm trying to get my django site under tests. I've started testing my pages using Client('url/to/my/page'), but I noticed that each test takes about a second to run (just to get a response code for the page--very basic tests). First of all, it seems like the client go through all the usual

Re: Saving Foreign Key Help

2009-06-17 Thread J. Cliff Dyer
On Wed, 2009-06-17 at 12:55 -0500, Dan Sheffner wrote: > I have this in my model: > > class Machine(models.Model): > name = models.CharField(max_length=100) > cpuInfo = models.ForeignKey(Cpu, blank=True, null=True) > > class Cpu(models.Model): > l = models.CharField(max_length=50)

Re: DjangoBook help Chapter 7

2009-04-17 Thread J. Cliff Dyer
On Fri, 2009-04-17 at 12:45 -0700, LeeRisq wrote: > Hey all, > > Thanks for reading. I have gone over and over the section first half > of the chapter about having a simple search form. Here are my views: > > from django.shortcuts import render_to_response > from mysite.books.models import Book

Re: .96 Tutorial maxlength/max_length confusion.

2009-04-07 Thread J. Cliff Dyer
On Tue, 2009-04-07 at 10:24 -0500, James Bennett wrote: > On Tue, Apr 7, 2009 at 9:33 AM, garyrob wrote: > > I'm doing the .96 tutorial because my company is using version 96.1 > > for now. > > Well, first things first, you should upgrade both yourself and your > company to

Re: GeoDjango: Extract Latitude and Longitude from PointField

2009-01-14 Thread J. Cliff Dyer
On Wed, 2009-01-14 at 09:49 -0800, Alfonso wrote: > Hey, > > Must be missing something extraordinarily simple - how do I > individually parse the latitude and longitude values from a PointField > entry into my app's templates? I just want... > > > Latitude: > Longitude: > > > Thanks, > >

Re: TabularInline across apps causing unknown error in admin.

2008-11-14 Thread J. Cliff Dyer
On Fri, 2008-11-14 at 11:41 -0500, Karen Tracey wrote: > On Fri, Nov 14, 2008 at 11:28 AM, J. Cliff Dyer <[EMAIL PROTECTED]> > wrote: > > Using Django 1.0, devel server, on RHEL5, with python 2.4. > > I have two apps, venues and

Re: TabularInline across apps causing unknown error in admin.

2008-11-14 Thread J. Cliff Dyer
On Fri, 2008-11-14 at 11:41 -0500, Karen Tracey wrote: > On Fri, Nov 14, 2008 at 11:28 AM, J. Cliff Dyer <[EMAIL PROTECTED]> > wrote: > > Using Django 1.0, devel server, on RHEL5, with python 2.4. > > I have two apps, venues and

TabularInline across apps causing unknown error in admin.

2008-11-14 Thread J. Cliff Dyer
y thoughts? -- Oook, J. Cliff Dyer Carolina Digital Library and Archives UNC Chapel Hill --~--~-~--~~~---~--~~ 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

Re: deleting a session

2008-07-02 Thread J. Cliff Dyer
On Wed, 2008-07-02 at 11:52 -0700, Bobby Roberts wrote: > > On Jul 2, 2:50 pm, "Juanjo Conti" <[EMAIL PROTECTED]> wrote: > > You mean in the views? > > > > del request.session['somedata'] > > Well If i have 15 session variables I don't want to have to do it for > each variable. > for key in

Re-ordering foreign key on OF admin

2008-06-30 Thread J. Cliff Dyer
are added and some get inserted in the middle of the list rather than at the end. Setting `ordering = ['field-name']` on the model for the table pointed to by the foreign key doesn't seem to affect its presentation in the referring table's admin page. Many thanks. -- Oook, J. Cliff Dyer Carolina Digital

Re: Getting the name of a class

2008-06-24 Thread J. Cliff Dyer
Maybe you're looking for MyModel.__name__ >>> from apps.myapp import models as m >>> m.Display.__name__ 'Display' >>> Cheers, Cliff On Mon, 2008-06-23 at 12:57 -0700, mwebs wrote: > Hi, > > thanks for your answer but I already tried this and it returns > something like this: > > But I

Re: My DateField is displaying "True" in my Admin??

2008-05-07 Thread J. Cliff Dyer
On Wed, 2008-05-07 at 07:37 -0700, Greg wrote: > Karen, > Here is the error that I'm getting: > > // > Enter a valid date in -MM-DD format. > // > > I'm using SQLite Go into the database shell using `manage.py dbshell` and type `PRAGMA TABLE_INFO(your_table_name);`. If you're unsure what

Re: What is reverse() good for? Not really reversing...

2008-05-02 Thread J. Cliff Dyer
On Thu, 2008-05-01 at 09:36 -0700, web-junkie wrote: > Hi, > > what is the new reverse() method good for? Seems it just swaps the > order_by statement? > I would appreciate a reverse() method that, if used after slicing, > would actually reverse the queryset. > In the docs it's said: "Django

Re: authenicate

2008-04-29 Thread J. Cliff Dyer
On Mon, 2008-04-28 at 13:01 -0700, Chris wrote: > Anyone see what I am doing wrong here? > Yes. You're not asking good questions. You neither tell us what happens when you run your code, nor what you expect to have happen. Please revise and repost. > http://dpaste.com/47296/ > > Thanks

Re: Troubles with localization

2008-04-14 Thread J. Cliff Dyer
Did you recompile your .po files on the server? On Mon, 2008-04-14 at 17:31 +0200, Boris Ozegovic wrote: > I recently translated Django on croatian language, it works like a > charm, but only on my computer? :) Today when I deployed application > to server, hr localization didn't worked. In

Re: Unexpected TypeError in m2m relationship

2008-03-26 Thread J. Cliff Dyer
On Wed, 2008-03-26 at 16:28 -0400, Karen Tracey wrote: > > > Thanks. Models file at: http://dpaste.com/41448/ > > > > That models.py has a couple of problems that make me think it can't > really be the one you are running with. __str__ for Artifact

Re: Unexpected TypeError in m2m relationship

2008-03-26 Thread J. Cliff Dyer
On Wed, 2008-03-26 at 15:08 -0400, Karen Tracey wrote: > On Wed, Mar 26, 2008 at 2:43 PM, J. Cliff Dyer <[EMAIL PROTECTED]> > wrote: > > On Wed, 2008-03-26 at 14:08 -0400, J. Cliff Dyer wrote: > > I've got a funky error when trave

Re: Unexpected TypeError in m2m relationship

2008-03-26 Thread J. Cliff Dyer
On Wed, 2008-03-26 at 14:08 -0400, J. Cliff Dyer wrote: > I've got a funky error when traversing a m2m relationship. > > TypeError: Cannot resolve keyword 'display' into field > > Code snippet and full traceback here: http://dpaste.com/41417/ > > Anyone have any ideas

Unexpected TypeError in m2m relationship

2008-03-26 Thread J. Cliff Dyer
I've got a funky error when traversing a m2m relationship. TypeError: Cannot resolve keyword 'display' into field Code snippet and full traceback here: http://dpaste.com/41417/ Anyone have any ideas where this is coming from? --~--~-~--~~~---~--~~ You

Re: Displaying the id in admin

2008-02-11 Thread J. Cliff Dyer
Except, I think with the svn version it's: def __unicode__(self) return self.id I'm working with 0.96, but I've come across something about that in the docs. Does it need to be "return u'%s' % self.id" to convert if self.id is an int? Cheers, Cliff On Mon, 2008-02-11 at 18:15 +0100,

Re: Complex Lookups

2008-01-23 Thread J. Cliff Dyer
Stephen Mizell wrote: >> Try this: >> >> x = [ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ] >> if x: >> d = x[0] >> q = Q(id=d['id']) & Q(title=d['title']) >> for d in x[1:]: >> q = q | (Q(id=d['id']) & Q(title=d['title'])) >> query =

Re: TemplateDoesNotExist at /admin/

2008-01-16 Thread J. Cliff Dyer
Guillermo wrote: > It doesn't work. :-( > > Two things, though I suppose it was a typo: > > Instead of: > > python/libs/site_packges/django/contrib/admin/templates > > ... i only found: > > python/libs/site_packges/django/contrib/admin/templatetags > > Is that correct? There are no html files in

Re: more than one field as a primary key

2008-01-15 Thread J. Cliff Dyer
Have you re-synced your database? Nader wrote: > I have define the following model: > > class Ingestqueue(models.Model): > ingestQueueId = models.IntegerField(primary_key=True) > datasetID = models.IntegerField() > filename = models.CharField(maxlength=100) > timeOfRemoteMOD =

Re: Outputting MS word-friendly format

2007-12-19 Thread J. Cliff Dyer
[EMAIL PROTECTED] wrote: > Thanks.. that's close, but I can't seem to get it to work properly > from within Django; > > They give an example like this: > def MakeExample1() : > doc = Document() > ss = doc.StyleSheet > section = Section() > doc.Sections.append(