Re: dynamic upcast

2008-10-23 Thread Carl Meyer
Hi harold, On Oct 23, 9:27 am, dadapapa <[EMAIL PROTECTED]> wrote: > If by "save a derived object from a parent instance" you mean that > the method that saves the object is defined in the parent class, > than this should not cause a problem, since type(self) will > dynamically identify the objec

Re: from mysite.polls.models import Poll, Choice

2008-10-24 Thread Carl Meyer
On Oct 23, 3:30 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > It's documented that way because it means we can have a tutorial that > doesn't immediately dump import-path configuration issues onto people > who are brand-new to Python; doing things the way the tutorial does > them, everything au

Re: from mysite.polls.models import Poll, Choice

2008-10-24 Thread Carl Meyer
On Oct 24, 9:30 am, Carl Meyer <[EMAIL PROTECTED]> wrote: > manage.py puts both the project dir itself and its parent dir > onto the Python path. Sorry, this is not accurate. manage.py only adds the project's parent dir explicitly. Importing by app name works because ge

Re: Default custom settings

2008-11-18 Thread Carl Meyer
On Nov 18, 10:43 am, mdnesvold <[EMAIL PROTECTED]> wrote: > The problem with using getattr(settings, 'MY_SETTING', default) is > that I'd have to specify the default value every time I access the > value; seems fairly un-DRY-ish, and if I ever want to change the > default, I'd have to track down e

Re: configuring production server for static media

2008-11-20 Thread Carl Meyer
Please stop the excessive top-posting; it makes reading the list digest painful. Quote only what you need to, and locate the quotes appropriately in your response. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

Re: Importing standalone apps in a project

2008-11-20 Thread Carl Meyer
On Nov 20, 10:22 am, "Saurabh Agrawal" <[EMAIL PROTECTED]> wrote: > Using the Python IDLE, I am able to issue command "import coltrane" without > problem. (coltrane is the name of standalone app) > > However, I am not able to do so using Django configured shell "python > manage.py shell". It woul

Re: Regional administrator

2008-11-20 Thread Carl Meyer
On Nov 20, 10:21 am, Huy Dinh <[EMAIL PROTECTED]> wrote: > Each user is allowed to make new posts and edit their own posts. They > are not allowed to create a post for a region that's not their own. The admin has hooks to allow you to do this sort of thing. This snippet[1] demonstrates the basic

Re: display of datefield breaks admin template

2008-09-30 Thread Carl Meyer
On Sep 30, 7:29 am, Gerard Petersen <[EMAIL PROTECTED]> wrote: > I get this trace:http://paste.pocoo.org/show/86579/ > > This is the model in question:http://paste.pocoo.org/show/86580/ Remove the strftime() call from your default= setting for the DateField. Django model fields automatically han

Re: Using forloop counter to index into a query set

2008-09-30 Thread Carl Meyer
On Sep 30, 11:05 am, SnappyDjangoUser <[EMAIL PROTECTED]> wrote: > > set up the data structures > > you pass to your view a bit differently so that you can loop over the > > forms and the products simultaneously (that is, pull apart the formset > > forms and zip them together with the product entr

Re: Translation of object.attribute in template

2008-09-30 Thread Carl Meyer
On Sep 30, 2:58 pm, Gerard Petersen <[EMAIL PROTECTED]> wrote: > It is indeed stored, I'm using a state machine > (http://www.djangosnippets.org/snippets/737/). Setting this up multilingual > could result in unusable orders states, when users change their locale during > the state/transition of

Re: display of datefield breaks admin template

2008-09-30 Thread Carl Meyer
On Sep 30, 2:19 pm, Gerard Petersen <[EMAIL PROTECTED]> wrote: > That did the trick. It does, however, leave me with a previous problem. When > I edit the object via a form (in my app) it displays the field value like > this "2008-09-30". And due to field validation the form widget only accepts

Re: Translation of object.attribute in template

2008-09-30 Thread Carl Meyer
On Sep 30, 3:29 pm, Gerard Petersen <[EMAIL PROTECTED]> wrote: > You lost me. You mean make the states numerical and in the array related its > (numeric) keys to the, then translatable, 'words'? > > If so, the problem would be that the ease of use in coding would stop to > exist. The statemachin

Re: How to invoke a request to an URL inside a web app without making a real request?

2008-10-01 Thread Carl Meyer
On Sep 30, 8:00 pm, maverick <[EMAIL PROTECTED]> wrote: > Hi, I have a django web application, I want to invoke a request of one > URL inside this application, e.g.  "/getdata/", and capture the output > of such URL and do some further processing. > > Of course I can do that by make a real request

Re: automatically generated field in admin

2008-10-01 Thread Carl Meyer
On Oct 1, 8:34 am, Ramashish Baranwal <[EMAIL PROTECTED]> wrote: > I have a model in which a field should be generated automatically. So > it shouldn't be shown in the admin add page. Also in the change page > it should be shown but should be non-editable. As an example- Pending ticket 342, anoth

Re: SlugField & prepopulate_from

2008-10-01 Thread Carl Meyer
On Sep 30, 9:27 pm, "Keith Eberle" <[EMAIL PROTECTED]> wrote: > Yea... I didn't know for sure, but I thought it used to.  That's why I > asked.  I wonder why that functionality wasn't there by default... Because in many cases it would be a usability problem. What if you've manually adjusted the

Re: Simple Invoices & Django

2008-10-03 Thread Carl Meyer
On Oct 3, 2:37 am, Gour <[EMAIL PROTECTED]> wrote: > I'm quite new with Python & Django but enthusiastic to work on 'porting' > Simple Invoices - PHP invoicing system - to Django > (seehttp://simpleinvoices.org/). Hi Gour, The django-developers list is solely for work on developing Django itsel

Re: Simple Invoices & Django

2008-10-03 Thread Carl Meyer
Whoops, sorry Gour! Got mixed up on which list I was reading. As you were... --~--~-~--~~~---~--~~ 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 T

Re: check if file exists before uploading | adding a validator to a field

2008-10-06 Thread Carl Meyer
Hi jelle, On Oct 6, 5:34 am, jelle <[EMAIL PROTECTED]> wrote: > Now, what I'd like to do is to write a validator which will check if a > ( renamed ) file is already existing. Writing the validator itself > isnt too hard; I can just use pre_save.connect and call a function > from here. What I do n

Re: Django Admin - Does not see templates, images or templates.

2008-10-08 Thread Carl Meyer
On Oct 8, 3:28 am, NoviceSortOf <[EMAIL PROTECTED]> wrote: > These 3 directories seem to contain many redundant files. > > /var/www/Django-1.0/django/ > /var/www/django-trunk/django/ > > /usr/lib/python2.3/site-packages/django/ > > How do I determine if one of these directories > contains a duplic

Re: Organizing apps without using projects

2008-10-08 Thread Carl Meyer
On Oct 7, 10:28 pm, Brent Hagany <[EMAIL PROTECTED]> wrote: > My apologies if this has been brought up before on this group - my > searching did not turn up anything, but my search skills are > notoriously suspect. > > I have been reorganizing my code so that it does not depend on the > project

Re: Branching proj/myapp into branch/0.1/myapp breaks

2008-10-08 Thread Carl Meyer
On Oct 8, 2:08 am, Gerard Petersen <[EMAIL PROTECTED]> wrote: > When the project dir is named 0.1 instead of djapp I get a trace (see below) > that it has no module 0.1. Where and why does django look at the name of the > parent (project) dir? In Python, you can happily put any directory into t

Re: Extend contrib.comments?

2008-10-08 Thread Carl Meyer
On Oct 7, 10:49 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > from django.contrib import comments > > def my_get_form(): >      return MyCommentForm > > comments.get_form = my_get_form This works, but it should be noted that it's an unfortunate monkeypatch that is necessary because contrib.com

Re: i18n in templates and views

2008-10-08 Thread Carl Meyer
On Oct 8, 12:22 am, J <[EMAIL PROTECTED]> wrote: > How would I include the "date" field from the first model ("Post") in > the queryset created from "PostI18N", using something similar to: > > queryset = > PostI18N.objects.filter(lang=get_language()).order_by('post__date') > > Would that date fiel

Re: Access a model's original get_absolute_url

2008-10-08 Thread Carl Meyer
On Oct 8, 5:29 am, Erik Allik <[EMAIL PROTECTED]> wrote: > I'm writing a content management framework which stores content in a   > tree of nodes. Nodes can be of different content types and I want to   > be able to add new content types by simply adding apps that provide   > models to INSTALLED

Re: Organizing apps without using projects

2008-10-08 Thread Carl Meyer
On Oct 8, 9:51 am, Brent Hagany <[EMAIL PROTECTED]> wrote: > I'm not in front of my code at the moment, but I'm pretty sure there's > no magic involved, and it works just fine.  When I do a runserver from > my (completely decoupled) project, the root urlconf sends everything > to umbrella.urls, wh

Re: Multiple projects, model inheritance, and one common database

2008-10-08 Thread Carl Meyer
On Oct 8, 12:47 pm, barbara shaurette <[EMAIL PROTECTED]> wrote: > We're building a couple of different projects - one social network-y > site, and one that's bloglike.  So each has its own unique database, > but they do share one common set of content. You'll almost certainly have better luck ha

Re: Branching proj/myapp into branch/0.1/myapp breaks

2008-10-08 Thread Carl Meyer
On Oct 8, 1:07 pm, Dan Ellis <[EMAIL PROTECTED]> wrote: > So what about all those Django apps with hyphens in their names? You won't find a Django app that asks you to put a directory with a hyphen into your Python path. Usually the pattern is for an app's human-readable name to look like "dja

Re: Branching proj/myapp into branch/0.1/myapp breaks

2008-10-08 Thread Carl Meyer
On Oct 8, 1:09 pm, Gerard Petersen <[EMAIL PROTECTED]> wrote: > Can somebody tell me how one would best store django apps and projects when > starting branches and tags under svn? If an app is reusable between projects I store it in its own separate VC repo (bazaar, in my case). If an app is sp

Re: Access a model's original get_absolute_url

2008-10-08 Thread Carl Meyer
On Oct 8, 2:30 pm, Erik Allik <[EMAIL PROTECTED]> wrote: > I've thought about this but I'm not sure how. Is there a hook/signal   > that gets fired when all models have been loaded but   > ModelBase._prepare hasn't run? No, there isn't, but it doesn't seem like you'd need that. It seems like lis

Re: Password Change Usage

2008-10-09 Thread Carl Meyer
On Oct 8, 11:56 pm, "Chris Spencer" <[EMAIL PROTECTED]> wrote: > Yeah, this has been a big let down. What I'd hoped would be a few > minutes setting up a basic site framework has turned into several > hours wasted on boilerplate. The lack of docs, templates, and strange > bugs like these leads me

Re: newbie question about breadcrumbs

2008-10-09 Thread Carl Meyer
Hi Mirto, On Oct 9, 9:04 am, Mirto Silvio Busico <[EMAIL PROTECTED]> wrote: > I'm confused because the admin app seems unaware of living inside a > project that is inside an apache site: the home link always point to the > first admin app page The admin breadcrumbs are never aware of anything ou

Re: Password Change Usage

2008-10-10 Thread Carl Meyer
On Oct 10, 7:44 am, "Chris Spencer" <[EMAIL PROTECTED]> wrote: > That might be the problem then. I dislike the default markup, so I'm > using my own. How do you find if the form as errors? > Usinghttp://docs.djangoproject.com/en/dev/topics/forms/as a guide, I've > tried using form.has_errors, for

Re: dynamic upcast

2008-10-19 Thread Carl Meyer
On Sep 12, 2:57 pm, dadapapa <[EMAIL PROTECTED]> wrote: >     class BaseClass(models.Model) : >         final_type = models.ForeignKey(ContentType) > >         def save(self,*args) : >             self.final_type = > ContentType.objects.get_for_model(type(self)) >             super(BaseClass,sel

Re: Admin view - merge two tables? (potentially bad db design)

2009-02-02 Thread Carl Meyer
This database design will result in lots of joins, but it's perfectly normalized and very flexible. Fine if you expect low traffic and you need the flexibility. The other downside is the extra administration complexity, which is the meat of your question. Fortunately Django's admin can help you

Re: object_detail 404 (queryset outdated?)

2009-02-02 Thread Carl Meyer
Hi Simon, On Feb 2, 7:36 am, Simon Westphahl wrote: > ### > class OfferManager(models.Manager): >     def get_query_set(self): >         return super(OfferManager, self).get_query_set().exclude > (start_date__gt=datetime.now).exclude(end_date__lt=datetime.now) > ### > > I'm using a queryset filt

Re: Admin view - merge two tables? (potentially bad db design)

2009-02-02 Thread Carl Meyer
On Feb 2, 6:44 pm, Zbigniew Braniecki wrote: > How can I overwrite the way Questions are selected so that when they > are returned by Question.objects.get('x') or Question.objects.filter() > or Question.objects.all() they are already joined with > QuestionProperties values? Try select_related()

Re: auth.contrib silently catching TypeError. Bug?

2009-04-27 Thread Carl Meyer
Hi Tamas, On Apr 23, 3:25 am, Tamas Szabo wrote: > For example if I have a Token based authenticator > (authenticate(token)) that is configured to be after my User/Password > based authenticator (authenticate(user, password)) in settings.py the > current code will call the user/password based au

Re: How to make a foreign key field of type other than int?

2011-10-24 Thread Carl Meyer
Hi, On Oct 24, 10:53 am, Kayode Odeyemi wrote: > I'm sorry but it doesn't just seem to work for me. I have tried > > possibilities like: > > self.fields['branch_name'].choices = > Branch.objects.all().values('name_branch', 'name_branch') > self.fields['branch_name'].choices = > Branch.objects.all

Re: ORM help

2011-04-26 Thread Carl Meyer
Hi Daniel, On Apr 22, 5:57 pm, Daniel Gerzo wrote: > I have a following models: > > class Movie(models.Model): >      title = models.CharField(max_length=255) >      year = models.IntegerField(max_length=4) >      rating = models.DecimalField(max_digits=2, decimal_places=1, default=0) > > class R

Re: Tests and temp tables

2015-02-05 Thread Carl Meyer
Hi Larry, On 02/05/2015 06:57 AM, Larry Martell wrote: > On Thu, Feb 5, 2015 at 7:29 AM, Jani Tiainen wrote: >> On Tue, 3 Feb 2015 19:38:31 -0500 >> Larry Martell wrote: >> >>> I have a django app that uses a temp table. In the real world this is >>> no issue, as each invocation of the app runs

Re: Tests and temp tables

2015-02-05 Thread Carl Meyer
On 02/05/2015 11:20 AM, Larry Martell wrote: > On Thu, Feb 5, 2015 at 10:53 AM, Carl Meyer wrote: >> TransactionTestCase has been around for quite a long time (since 1.1, >> IIRC). It's definitely in 1.5. > > I thought it was not in 1.5 because I went to > https://

Re: Logging transaction statements?

2015-02-10 Thread Carl Meyer
Hi Erik, On 02/10/2015 10:28 AM, Erik Cederstrand wrote: > Hmm, I'm beginning to think I don't understand Django transactions. I > have the following two snippets, boiled down from my original code. The > first one calls cache methods via helper functions, the other one calls > the cache methods d

Re: Logging transaction statements?

2015-02-10 Thread Carl Meyer
On 02/10/2015 01:27 PM, Erik Cederstrand wrote: >> Den 10/02/2015 kl. 18.34 skrev Carl Meyer > <mailto:c...@oddbird.net>>: >> >> I assume you're using the 'db' cache backend? Otherwise, it wouldn't >> make sense to expect transactions

Re: Logging transaction statements?

2015-02-10 Thread Carl Meyer
On 02/10/2015 02:46 PM, Carl Meyer wrote: > On 02/10/2015 01:27 PM, Erik Cederstrand wrote: >>> Den 10/02/2015 kl. 18.34 skrev Carl Meyer >> <mailto:c...@oddbird.net>>: >>> >>> I assume you're using the 'db' cache backend? Otherwise,

Re: Logging transaction statements?

2015-02-10 Thread Carl Meyer
Hi Erik, On 02/10/2015 03:30 PM, Erik Cederstrand wrote: > Den 10/02/2015 kl. 21.27 skrev Erik Cederstrand > : >> >> Running this in parallel in two processes on the same machine >> returns this after a while: >> >> Process A: [...] >> >> Process B: [...] Traceback (most recent call last): File

Re: Logging transaction statements?

2015-02-10 Thread Carl Meyer
On 02/10/2015 04:03 PM, Erik Cederstrand wrote: >> But `self.connection.set_isolation_level()` is called in >> `_set_autocommit()`, and that should be sufficient. (The >> `_set_isolation_level()` method is dead code in 1.7 and has since >> been removed, but what really matters is that >> `self.c

Re: how to handle race conditions?

2015-02-18 Thread Carl Meyer
Hi Abraham, On 02/17/2015 10:01 PM, Abraham Varricatt wrote: > I'm trying to make an app where folks can order X quantity of an item. > The condition is that the order should only be made if inventory exists. > Assume that we have stock of Y items. This means that only if Y >= X > should we allow

Re: how to handle race conditions?

2015-02-19 Thread Carl Meyer
Hi Abraham, On 02/19/2015 03:41 AM, Abraham Varricatt wrote: > I've heard of the term 'atomic operations' , but didn't realize it had > support in django. Thank you for the detailed explanation! You're welcome. > It's an interesting idea - to mark the field in the database as a > positive intege

Re: Question about form security.

2015-02-19 Thread Carl Meyer
On 02/19/2015 04:03 PM, Chen Xu wrote: > what if I have two addresses, id is 1 and 2, and I want to update 2, how > I should distinguish 2 from 1, I mean, if I have addressid in the form, > and someone modify it from 2 to 1, and that will update 1, right? How to > prevent this? Your server-side co

Re: Migrations force me to have, forever, any name/reference I use in field validators=, choices=, whatever, valid forever (even if the requirements change).

2015-02-26 Thread Carl Meyer
On 02/26/2015 08:41 AM, Carsten Fuchs wrote: > Hi all, > > Am 26.02.2015 um 13:54 schrieb Tim Graham: >> Yes, it's expected behavior. Please see the documentation on the topic: >> https://docs.djangoproject.com/en/stable/topics/migrations/#historical-models >> > > I have not yet tried this, but w

Re: Problem installing and using smart_selects

2015-03-01 Thread Carl Meyer
Hi Michael, On 03/01/2015 01:11 AM, Michael Ackary wrote: > Smart Selects looked so simple and promising for chained selects > (https://github.com/digi604/django-smart-selects). However, no matter > how I install it, it doesn't seem to work. Here is what I've tried: > > > *Attempt #1 - putting

Re: Fixing a poorly written Django website (no unit tests)

2015-03-06 Thread Carl Meyer
On 03/06/2015 11:23 AM, Ilya Kazakevich wrote: > You may start from highest level testing: > 1) create "usage scenarios" for your website. Like "customer opens page > 'foo', and should see 'bar'". You use such scenarios for manual testing, > right? > 2) code such scenarios against Django project.

Re: Using the eval() command

2015-03-10 Thread Carl Meyer
Hi Henry, On 03/10/2015 03:25 PM, Henry Versemann wrote: > I have a new dictionary that I want to build, using data from another > dictionary. I have a view which is receiving a single key/value pair > from the original dictionary. Then in the view I've defined the new > dictionary like this: > >

Re: Django 1.6's lifespan for security updates?

2015-03-10 Thread Carl Meyer
Hi Christian, On 03/10/2015 01:44 PM, Christian Hammond wrote: > According to > https://docs.djangoproject.com/en/1.7/internals/release-process/#supported-versions, > it appears that when Django 1.8 is released, Django 1.6 will no longer > receive security updates. I wanted to verify that this is

Re: Django 1.6's lifespan for security updates?

2015-03-11 Thread Carl Meyer
Hi Stephen, On 03/11/2015 06:28 AM, Stephen Gallagher wrote: > So, here's the basic problem. The distributions that are packaging > python 2.6 are, basically Red Hat Enterprise Linux 6 and its clones > (CentOS, Scientific Linux, Oracle, etc.) and SUSE Linux Enterprise > Server 11. These two distri

Re: Using the eval() command

2015-03-12 Thread Carl Meyer
Hi Henry, On 03/10/2015 07:37 PM, Henry Versemann wrote: > So how does an expression like you suggested above ( > innerDict['+newinnrkey+'] = newinnrval ) work then? > It seems like it wouldn't work without enclosing the expression > with quotes or double-quotes, and even then it seems like it wou

Re: Testing template context processors

2015-03-17 Thread Carl Meyer
Hi Gergely, On 03/17/2015 10:52 AM, Gergely Polonkai wrote: > I wrote a context processor which makes some global variables of mine > available for templates. I cannot find a good (cough… any) article on > how to test such processors. Could you give me some directions on where > to start with writ

Re: Django 1.6's lifespan for security updates?

2015-03-19 Thread Carl Meyer
On 03/19/2015 01:01 AM, Russell Keith-Magee wrote: > On Thu, Mar 19, 2015 at 12:05 PM, James Bennett > wrote: > Way, way, *way* back in the day, there was unofficial bugfix support > for pre-magic-removal versions of Django run on the basis of "some > peop

Re: Re-run only tests that failed last time

2015-03-24 Thread Carl Meyer
Hi Gergely, On 03/24/2015 04:27 AM, Gergely Polonkai wrote: > I have a pretty extended test suite for my application, which can run > for about 15 minutes. Now when I introduce an error, I will be notified > of it pretty late, and a one-liner fix needs another 15 minutes to > check. Of course if o

Re: QueryDict and its .dict() method - why does it do that?

2015-03-27 Thread Carl Meyer
Hi Gabriel, On 03/27/2015 01:34 PM, Gabriel Pugliese wrote: > @Masklinn > That input is from jQuery's default serializer. It sends the data with > contentType 'application/x-www-form-urlencoded; charset=UTF-8'. I just > need to pass a data parameter with my JS Object (JSON) and it does the > magic

Re: QueryDict and its .dict() method - why does it do that?

2015-03-27 Thread Carl Meyer
Hi Gabriel, On 03/27/2015 02:10 PM, Gabriel Pugliese wrote: > I perfectly understand what you are saying. It was very clear and > informative, but do not agree with the design chosen here. Below is just > an opinion and you do not have to agree with it: That's good :-) I probably won't continue w

Re: Help with Dynamically Adding Forms to Formset!!

2015-03-30 Thread Carl Meyer
Hi Stephanie, On 03/30/2015 02:37 PM, Stephanie Socias wrote: > I'm having trouble creating a formset where I can dynamically add and > delete items. I've tried many different approaches and can't get > anything to work. I'm new to Django and have been at this for days. Can > someone please help m

Re: Problem after Virtualenv Setup

2015-04-02 Thread Carl Meyer
Hi Kishan, On 04/02/2015 09:41 AM, Kishan Mehta wrote: > I have created my django project and worked on it . Recently I came to > know about virtualenv and the problem it solves. > I have installed virtualenv and activated that environment. > Now django command is not recognized. > * Will I have t

Re: How do I manage a Non-default Django PostgreSQL database

2015-04-09 Thread Carl Meyer
On 04/09/2015 07:12 AM, Stephen M wrote: > If Django migrations with PostgreSQL is a bit flaky (as suggested by > S.O. comment) which backend database is reliably supported by the Django > migrations mechanism? The premise is false. Postgres is almost certainly the best-supported database for Djan

Re: Migrations During Development

2015-04-25 Thread Carl Meyer
On 04/25/2015 06:48 AM, Jorge Andrés Vergara Ebratt wrote: > Are you using version control like GIT? I save the migration folder with > the __init__.py in GIT, nothing else, because al the migrations will be > diferent in the diferent servers. This is not a good idea. Migrations should be committe

Re: Migrations During Development

2015-04-25 Thread Carl Meyer
On 04/25/2015 11:15 AM, Javier Guerra Giraldez wrote: > On Sat, Apr 25, 2015 at 12:08 PM, Timothy W. Cook > wrote: >> >> On Sat, Apr 25, 2015 at 9:48 AM, Jorge Andrés Vergara Ebratt >> wrote: >>> >>> Are you using version control like GIT? I save the migration >>> folder with the __init__.py in

Re: Migrations During Development

2015-04-25 Thread Carl Meyer
On 04/25/2015 11:28 AM, Timothy W. Cook wrote: > if you don't store migrations, then you have to generate them on each > production update, right? if so, wouldn't they count as untested > code? how about manually tweaked, or data migrations? > > > ​That will certainly be true once y

Re: Migrations During Development

2015-04-25 Thread Carl Meyer
On 04/25/2015 05:18 PM, Carl Meyer wrote: > You can use the "squash" feature [1] to squash a set of historical > migrations down to a single migration. Forgot this link: https://docs.djangoproject.com/en/1.8/topics/migrations/#squashing-migrations Carl -- You received this mes

Re: forcing user model to return first_name last_name if exists

2015-04-28 Thread Carl Meyer
On 04/28/2015 09:10 AM, Ilya Kazakevich wrote: > I have many places in my app where user (from user model) is displayed: > templates, forms, fliters, tables etc. > It is displayed as username everywhere. > > I want it to be displayed as first_name/last_name. > > I can do that with monkey patching

Re: Django runserver needs restart on psql data changes

2015-04-29 Thread Carl Meyer
Hi Arnab, On 04/29/2015 03:13 PM, Arnab Banerji wrote: > Hi Javier - thanks for the response. Yes - I am storing the data in a > dictionary - then having django_tables2 API render the dictionary as a > table. How do I force a read of that variable for every browser refresh > on the client side?

Re: RemovedInDjango19Warning: Model class %s doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS ..

2015-04-29 Thread Carl Meyer
Hi, On 04/29/2015 11:13 AM, Bumyong Choi wrote: > I am trying to understand this warning better. I understand that we want > to make sure that a model has an explicit app_label or it is in > INSTALLED_APPS. I spent some time trying to remove warnings from my code > because I was getting these warn

Re: Why so complicated :O??

2015-05-06 Thread Carl Meyer
Hi Vesko, On 05/06/2015 12:47 PM, Vesko Nikolov wrote: > Hello everyone. So i have been trying to learn Django for the last > couple of months but have been seeing it quite hard. I have a decent set > of skills in PHP but i wanted to learn something newer and that is what > brought me here. So on

Re: Ensure an object is saved even when the atomic bock rollsback

2015-05-08 Thread Carl Meyer
Hi Marc, On 05/08/2015 07:15 AM, Marc Aymerich wrote: > I'm using atomic requests, but one of my views needs to save a model > regardless of wheter the current transaction rolls back or not. > > I'm confused about how to proceed with the current autocommit behaviour. > Do I need to use a differen

Re: Django code of conduct - last line

2015-05-08 Thread Carl Meyer
Hi Graham, On 05/08/2015 01:43 PM, Graham Oliver wrote: > Thank you, so how about > > 'Don’t forget that it is human to err and blaming each other doesn’t get > us anywhere. > Instead, focus on helping to resolve issues and learning from mistakes' I think this is an improvement in clarity and st

Re: Invalid HTTP_HOST, can someone explain why I am getting this?

2015-05-15 Thread Carl Meyer
On 05/15/2015 09:14 AM, Andreas Kuhne wrote: > You are getting it because someone has come to your server by > entering www.g3suprimentos.com.br in > a browser. If you don't have that address in the allowed hosts setting, > you will get the error you have received

Re: Invalid HTTP_HOST, can someone explain why I am getting this?

2015-05-16 Thread Carl Meyer
> On May 16, 2015, at 8:12 AM, Gerald Klein wrote: > > This looks like a cross domain request that is being received by your site > and the requestor is not listed in your sites allowed sites list, Sites > conforming with CORS will have a list of sites that can request data via http > from th

Re: Adding a one field to user model: trying not to create custom one)

2015-05-18 Thread Carl Meyer
Hello Ilya, On 05/18/2015 04:58 PM, Ilya Kazakevich wrote: > I want to add just a one field to my model, and this field participates > in user representation ( I use monkeypatch to change __str__). > > Django manual tells me to create profile with one-to-one relation in > this case. Well, it may

Re: Adding a one field to user model: trying not to create custom one)

2015-05-19 Thread Carl Meyer
On Tuesday, May 19, 2015 at 8:18:24 AM UTC-6, Ilya Kazakevich wrote: > > > I am really unhappy with idea of using custom user model. >> >> Why? >> >> If it's because this is an existing project and the prospect of >> migrating your existing data to a custom user model is daunting, I >> totally

Re: Why the extra minute in PostgreSQL when using time zone info?

2015-05-29 Thread Carl Meyer
Hi aRkadeFR, On 05/29/2015 02:09 AM, aRkadeFR wrote: > Indeed, the problem comes from the representation on PG, > cause I have only good results (0/30 for the minutes) from > the python function. [snip] The OP already found and posted the solution (see below) and it is not related to Postgres. He

Re: Help with customizing Django authentication

2015-05-29 Thread Carl Meyer
Hello Carlos, On 05/29/2015 03:19 PM, Carlos Ribas wrote: > Hello, > > I have to confess that I did not understand your suggestion. How this > will help me to reverse the logic of my system? I mean, instead of User > with or without a profile (the Person class, in my case), I want a > Person with

Re: Bug? Infinite migrations with empty help_text and ugettext_lazy

2015-06-04 Thread Carl Meyer
Hi Andy, On 06/04/2015 09:44 AM, Andy Gimblett wrote: > I've come across something which might possibly be a Django bug, but I wanted > to raise it here first in case I'm missing something, or this is expected > behaviour. > > There's a fuller explanation and easily runnable example here: > >

Re: Bug in 1.7-1.8 migrations

2015-06-05 Thread Carl Meyer
Hi! On 06/05/2015 05:29 AM, Владислав Пискунов wrote: > In 1.7 auto-created migration with makemigrations. it contains: > > | > related_name=b'' > | > > Now in 1.8 while migrate, django tries Render model state and fails with: > [snip] > File > "/home/vladislav/.virtualenvs/furskru/local/li

Re: Upgrade Confusion with ForeignKey

2015-06-05 Thread Carl Meyer
Hi Tim, On 06/05/2015 03:44 PM, Tim Sawyer wrote: > I've just upgraded from a very old version of Django (1.4) up to 1.7.8, > and some behaviour isn't how I expect. I may have missed something - > I've not been keeping an eye on the framework changes. I would strongly recommend that you upgrade

Re: Upgrade Confusion with ForeignKey

2015-06-05 Thread Carl Meyer
Hi Tim, On 06/05/2015 04:26 PM, Tim Sawyer wrote: > Thanks. :-) > > Did that, read the release notes, made sure it worked after each upgrade > stage. This is an esoteric corner of my app, and I didn't notice it not > working. The other foreign key stuff I have seems to work ok. Ah, good! In th

Re: Have mercy please!

2015-06-10 Thread Carl Meyer
Hi Jon, Thanks for sharing your experience. On 06/09/2015 07:25 PM, Jon Foster wrote: > I've been involved with Django, on and off, since v0.96 or so. I love > Django and think its the most productive way to build rich websites with > custom defined content types. Throw in Django-CMS and things g

Re: Best Practices for Migrations in Reusable Apps?

2015-06-10 Thread Carl Meyer
Hi Jonathan, On 06/10/2015 12:24 AM, Jonathan Barratt wrote: > I'm interested to know what the community's opinions are on how best > to package migrations with reusable apps (I'm thinking of the > built-in migrations, but it seems the same principles would apply for > pre-1.8 south migrations). >

Re: Squashed migration

2015-06-12 Thread Carl Meyer
On 06/12/2015 06:32 AM, aRkadeFR wrote: > You need to delete your old migrations so it uses only the squashed > one after. No, the squashed migration should be used in place of the old ones for any new database, even if the old ones are still present. This is the point of the squashmigrations feat

Re: Squashed migration

2015-06-12 Thread Carl Meyer
Hi Cherie, On 06/12/2015 06:32 AM, Cherie Pun wrote: > Thanks for your replies! I am still on Django 1.7 but we are hoping to > upgrade to 1.8 soon. I manage to use the squashed migrations when > creating the test database now, Do you know why it didn't work initially? That'd be useful to know, i

Re: Django 1.8 Transaction Begin

2015-06-18 Thread Carl Meyer
Hi Kate, On 06/18/2015 04:05 AM, Katarzyna Łabędź wrote: > Maybe i didn't understand it correctly. > > I know Django support transactions, but isn't it do it on commit? > I just tried to find the BEGIN statement inside them and i could not > find it - searched through internet and what I found

Re: Inconsistency when importing views and models

2015-06-21 Thread Carl Meyer
Hi, On 06/19/2015 08:32 PM, Peith Vergil wrote: > It depends on how your project files are structured. If you have a file > structure that looks like this: > > app/ > __init__.py > models.py > views.py > urls.py > > Then, you can simply use relative imports. > > In views.py: > f

Re: Inconsistency when importing views and models

2015-06-21 Thread Carl Meyer
On 06/19/2015 11:41 PM, James Schneider wrote: > This is strictly a Python question, nothing Django-specific, but I've > found this site to be helpful in explaining the different ways to import > things: > > http://effbot.org/zone/import-confusion.htm This is good as far as it goes, but it is a

Re: Atomic block termination question

2015-06-24 Thread Carl Meyer
Hi Mike, On 06/24/2015 02:16 AM, Mike Dewhirst wrote: > On 24/06/2015 4:43 PM, Mike Dewhirst wrote: >> When saving a model I'm getting a TransactionManagementError - You can't >> execute queries until the end of the 'atomic' block >> >> Ticket #21540 seems fairly explicit at least where Postgres i

Re: Atomic block termination question

2015-06-25 Thread Carl Meyer
Hi Mike, On 06/25/2015 01:53 AM, Mike Dewhirst wrote: > On 25/06/2015 2:34 AM, Carl Meyer wrote: >> On 06/24/2015 02:16 AM, Mike Dewhirst wrote: >>> On 24/06/2015 4:43 PM, Mike Dewhirst wrote: >>>> When saving a model I'm getting a TransactionManagementError -

Re: Django model for non web applications

2015-07-02 Thread Carl Meyer
On 07/02/2015 05:49 PM, Russell Keith-Magee wrote: > > On Thu, Jul 2, 2015 at 12:50 AM, Jeff Fritz > wrote: > > I'm fairly new to Django and making my way through the tutorial. > > Knowing what I've learned so far, I'd like to explore using > django.db.mo

Re: Django formset hidden id field

2015-07-02 Thread Carl Meyer
On 06/28/2015 03:00 PM, Peter of the Norse wrote: > On May 27, 2015, at 7:47 AM, Cheng Guo > wrote: >> >> Hello, >> >> I have a formset and when I render it, Django would include this line >> in the HTML: >> >> || >> >> I am curious what is the purpose of having an id

Re: Django model for non web applications

2015-07-03 Thread Carl Meyer
quired in order to use the ORM (which is the core of Jeff's use case). Carl > > > On Thursday, July 2, 2015 at 6:50:20 PM UTC-6, Carl Meyer wrote: > > On 07/02/2015 05:49 PM, Russell Keith-Magee wrote: > > > > On Thu, Jul 2, 2015 at

Re: Django formset hidden id field

2015-07-06 Thread Carl Meyer
Hi Peter, On 07/04/2015 12:42 AM, Peter of the Norse wrote: >> On Jul 2, 2015, at 7:46 PM, Carl Meyer wrote: >> >>> So what? It’s quite likely that whoever is editing this row of >>> the database, also has permissions to edit the other rows as >>>

Re: Testing related models without saving

2015-07-16 Thread Carl Meyer
Hi Roland, On 07/16/2015 07:46 AM, Roland Swingler wrote: >> i'll just say that Django tests don't favor too much into the "unit" > test spectrum; > > That is what I'm seeing - it is the same with rails out of the box as > well. I guess I'm just curious to know whether: > > a) the 'unit' test en

Re: All posts from same day django

2015-07-22 Thread Carl Meyer
Hi, On 07/22/2015 12:54 PM, Nkansah Rexford wrote: > I currently have: > > | > @classmethod > defget_past_week(self): > start_date =datetime.now().date() > end_date =datetime.now().date()-timedelta(weeks=1) > > returnMyModel.objects.filter(pub_date__range=(end_date

Re: All posts from same day django

2015-07-22 Thread Carl Meyer
On 07/22/2015 02:26 PM, Nkansah Rexford wrote: > Thanks Carl > > Also got these approaches too, might help someone > too: > http://stackoverflow.com/questions/31571607/all-posts-from-same-day-only-django I just re-read your original post, and my suggestion was wrong - it gets you all posts from

  1   2   3   >