Re: Django Models: How to allow users to select an image from a choice of 3 pictures

2012-07-24 Thread Melvyn Sopacua
miley_neutral.png', 'ask me later'), ('smiley_happy.png', 'happy happy joy joy'), ) in template: {% load static %} ... And of course you can dress it up as Ivan showed, but the basic principles are the same. -- Melvyn Sopacua -- You received this me

Re: Models: Referencing A Model In Another App and Different Project

2012-07-27 Thread Melvyn Sopacua
ngo database drivers are not specifically for spatial databases. And similarly spatial databases can contain tables (and thus django models) that have no geometric fields. So - it is possible to use all your applications in a spatially enabled database with the spatially enabled database driver. --

Re: 'NoneType' object has no attribute 'datetime' bug?

2012-07-30 Thread Melvyn Sopacua
ls import timezone current_date = timezone.now() end_date = current_date.replace(hour=19, minutes=30) self.current_date = current_date self.end_date = end_date -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users"

Re: access the state of a Model object prior to it's modification ?

2012-07-30 Thread Melvyn Sopacua
ustom form that derives forms.ModelForm. Add a BooleanField to this custom form with a HiddenInput widget. Populate that field in ModelAdmin.get_form(). Some wrestling with formfield_overrides may be necessary. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google

Re: merge data from multiple models

2012-07-30 Thread Melvyn Sopacua
t;>> fast.slow >>> fast.slow.description 'slow model 1' >>> fast.slow.result 2 -- Melvyn Sopacua -- 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.

Re: Django Unit Tests Missing Database Columns

2012-07-30 Thread Melvyn Sopacua
e a relic of a previous syncdb and isn't created properly on a clean environment. -- Melvyn Sopacua -- 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 unsubscrib

Re: merge data from multiple models

2012-07-31 Thread Melvyn Sopacua
On 30-7-2012 19:50, joris benschop wrote: > > > Op maandag 30 juli 2012 16:06:38 UTC+2 schreef Joris het volgende: >> >> >> >> On Monday, July 30, 2012 3:52:31 PM UTC+2, Melvyn Sopacua wrote: >>> >>> >>> If this is not implemented

Re: Adding more data to Generic Views

2012-07-31 Thread Melvyn Sopacua
is there a point at which > they are considered to restricting? Not really. The only thing that bugs me about them is that adding extra context requires sub-classing so you end up with a views.py that solely consists of sub-classed generic views with 3 lines of get_context_data(). -- Melvyn Sopa

Re: merge data from multiple models

2012-07-31 Thread Melvyn Sopacua
orresponding the view's rid_fastmodel. syncdb becomes your enemy, but it is the cleanest solution. [1] http://www.postgresql.org/docs/9.1/static/sql-createview.html, http://www.postgresql.org/docs/9.1/static/tutorial-views.html -- Melvyn Sopacua -- You received this message because you ar

Re: Exlude xampp-htdocs-projects from beeing treated as Django projects?

2012-07-31 Thread Melvyn Sopacua
ly route locations specific to django to the django wsgi application and let everything else be handled by the webserver. What is best for your situation only you can decide. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: presenting a manytomany relationship in a tabular way

2012-07-31 Thread Melvyn Sopacua
ngoproject.com/en/1.4/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display> <https://docs.djangoproject.com/en/1.4/ref/contrib/admin/actions/> Alternatively, you can use list_editable: <https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_e

Re: merge data from multiple models

2012-08-01 Thread Melvyn Sopacua
a generic class-based view to either be model.objects.all() for the fast version or model.objects.calculate_slow_stuff() for the slow version. [1] https://docs.djangoproject.com/en/1.4/ref/contrib/gis/geoquerysets/#django.contrib.gis.db.models.GeoQuerySet.area -- Melvyn Sopacua -- You received this messa

Re: Returning data belonging to a model (FK)

2012-08-02 Thread Melvyn Sopacua
y': { 'name': 'Netherlands', 'code': 'NL' } } The principle applies though, you can fetch the fields you want and tack on the result on whatever object instance you want to tack it on that you have access to. You can't however tack it on to classes, o

Re: Adding more data to Generic Views

2012-08-02 Thread Melvyn Sopacua
_data(self, **kwargs) : context = super(MyView, self).get_context_data(**kwargs) context['qs'] = self.request.GET return context [1] <https://docs.djangoproject.com/ref/templates/api.html#subclassing-context-requestcontext> -- Melvyn Sopacua -- You received th

Re: Weird test-behaviour in combination with localization

2012-08-02 Thread Melvyn Sopacua
lue in the > view and in the test, in both cases it is de-de. > Any ideas, why my test is fine if it runs alone and fails when all tests of > the project (including the django-ones) are run? Im fresh out of ideas and > a little bit puzzled :D On a hunch, I suspect the LOCALE_PATHS setti

Re: ContentType and multiple database

2012-08-02 Thread Melvyn Sopacua
his_type(pk=self.ext_object_id).values("nombre") Rather then fighting the project separation, the easiest solution by far is to make the data available by webrequest in a format you can read, like json or XML and use python's httplib to fetch it. -- Melvyn Sopacua -- You received

Re: Return SQL calculation within queryset

2012-08-02 Thread Melvyn Sopacua
On 25-7-2012 2:03, jondbaker wrote: > I've implemented the spherical law of cosines to aid in proximity-based > searching. Is there a specific reason you're not using GeoDjango? Specifically: <https://docs.djangoproject.com/en/1.4/ref/contrib/gis/geoquerysets/#distance-

Re: Url regex keeps django busy/crashing

2012-08-02 Thread Melvyn Sopacua
raise 404 Even more improvements if you keep the urls lower case (or uppercase, but not mixed case) and use [a-z0-9_] instead of \w. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Url regex keeps django busy/crashing

2012-08-02 Thread Melvyn Sopacua
On 3-8-2012 2:34, Melvyn Sopacua wrote: Correction: > url(r'^(?P\w[\w-]+-/$', 'detail') insert question mark here --> ? -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to th

Re: Django Userena Problem

2012-08-02 Thread Melvyn Sopacua
over existing accounts that did not have a profile. They're easily created though, even in a small script by catching the UserProfile.DoesNotExist exception. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: Detecting browser type after login

2012-08-02 Thread Melvyn Sopacua
lude a javascript bit, that generates the popup /and/ calls the view that resets the just_logged_in field. -- Melvyn Sopacua -- 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 u

Re: TinyMCE config

2012-08-02 Thread Melvyn Sopacua
their base class. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegr

Re: DRYing up my forms.py

2012-08-03 Thread Melvyn Sopacua
ing, such that if a field > is a date field, it always gets these settings without me having to > explicitly set them? Well, you almost answered your own question. Subclass the DateField. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups

Re: How to override an attribute?

2012-08-04 Thread Melvyn Sopacua
7;s what you're saying above translated to the database layer. Either provide actual code that makes sense or rethink if what you're doing is really needed. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: DRYing up my forms.py

2012-08-04 Thread Melvyn Sopacua
On 3-8-2012 18:23, Lee Hinde wrote: > > On Aug 3, 2012, at 9:01 AM, Melvyn Sopacua wrote: > >> On 3-8-2012 17:37, Lee Hinde wrote: >> >>> self.fields['photo_response'].widget.attrs["class"] = 'date-field >>> input-small' &

Re: dynamic fildsets on ModelAdmin

2012-08-05 Thread Melvyn Sopacua
you do this via inlines for related objects or you subclass a ModelForm and set the form attribute of the ModelAdmin. -- Melvyn Sopacua -- 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

Re: Django application template

2012-08-05 Thread Melvyn Sopacua
or it's homegrown and all you need is to do is symlink a directory or extract a release tarball. What are the things that require simplification exactly? -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to th

Re: Sample Django template scrolling table

2012-08-05 Thread Melvyn Sopacua
Is this pure for the eye-candy or performance? I don't think you gain much if this is for performance, because you will generate more requests for the same data. In fact, I'd say it's detrimental for performance to fetch additional rows on request through Ajax mechanisms. -- Melvy

Re: Dynamic form field type.

2012-08-05 Thread Melvyn Sopacua
verride the template and add the url for this dynamic javascript to the template. Take a look at contrib/gis/templates/gis/admin/openlayers.js for django-generated javascript inspiration. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users&quo

Re: How to override an attribute?

2012-08-05 Thread Melvyn Sopacua
def is_pregnant(self) : return False @pregnant.setter def is_pregnant(self, value) : pass class Man(Person) : pass class Woman(Person) : is_pregnant = models.BooleanField() -- Melvyn Sopacua -- You received this message because you are subscri

Re: fastcgi vs wsgi

2012-08-06 Thread Melvyn Sopacua
er find that uwsgi gives you a lot of control combined with sane defaults. Limits to configure include memory usage and forking models. So you main goal is to turn off in django what you don't need. Candidates: - i18n/l10n - cachemiddleware - context processors - settings.DEBUG - uninstall PIL i

Re: Dynamically adjusting STATIC_URL depending on http or https requests?

2012-08-06 Thread Melvyn Sopacua
^/(.*)$ https://secured/$1 last; } } Then in settings.py: STATIC_URL = '/static/' -- Melvyn Sopacua -- 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

Re: Compile/generate JavaScript from Django Templates?

2012-08-07 Thread Melvyn Sopacua
le and pointed to contrib/gis/templates/gis/admin/openlayers.js. [1] https://docs.djangoproject.com/en/1.4/topics/templates/#templates -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: Nullable User email

2012-08-07 Thread Melvyn Sopacua
before you call super(). This does involve a bit of a copying from db/models/ModelBase.__new__ but it's cleaner as __new__ is meant exactly for this purpose. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: formeset choicefield dynamic choices

2012-08-08 Thread Melvyn Sopacua
exactly 1 argument (2 given)" formset.add_fields() should give you the same possibilities without needing to override init signature. -- Melvyn Sopacua -- 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@

Re: Created & updated date/time in models

2012-08-11 Thread Melvyn Sopacua
uires raw SQL [3]. [1] <https://docs.djangoproject.com/en/1.4/howto/initial-data/#providing-initial-sql-data> [2] <https://docs.djangoproject.com/en/1.4/ref/contrib/contenttypes/> [3] <https://docs.djangoproject.com/en/1.4/topics/db/sql/> -- Melvyn Sopacua -- You received this

Re: Django app to update site through email

2012-08-12 Thread Melvyn Sopacua
hing more generic that would work essentially with any Email server > that supports IMAP. Oh oh you youngins ;) http://www.fetchmail.info/ -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to thi

Re: Django app to update site through email

2012-08-12 Thread Melvyn Sopacua
trivial, explaining that to casual internet users has been a problem since the inception of S-MIME and PGP. I imagine most projects that have attempted this principle strand on this issue and the associated spam nightmare. -- Melvyn Sopacua -- You received this message because you are subscrib

Re: custom management commands: AttributeError: 'module' object has no attribute 'Command'

2012-08-12 Thread Melvyn Sopacua
rovide the *full* traceback for more clues. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubs

Re: different language for admin/front-end

2012-08-12 Thread Melvyn Sopacua
age code is not part of the URL. Second best is the session cookie, though I don't really see a simple way to properly set it back if one leaves the admin site (which isn't the same as logging out). [1] <https://docs.djangoproject.com/en/1.4/topics/i18n/translation/#how-django-disco

Re: Django app to update site through email

2012-08-13 Thread Melvyn Sopacua
On 13-8-2012 12:37, Paul Backhouse wrote: > I like the idea of "secret email addresses". I think this is what > spamcop.net does. A good example is actually My Opera and I think wordpress uses something similar as well. -- Melvyn Sopacua -- You received this message because yo

Re: Django app to update site through email

2012-08-13 Thread Melvyn Sopacua
at messages could expire after a certain period > if the user didn't respond to them. That's a good idea actually. Your only problem will be the security of the user's email account and while that has been proven less secure then one would expect, it makes identity theft the

Re: Django: How to get American date format in a form?

2012-08-13 Thread Melvyn Sopacua
ms.models.modelform_factory will shed some light on this. And of course: <https://docs.djangoproject.com/en/1.4/ref/forms/fields/#localize> -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: AttributeError

2012-08-13 Thread Melvyn Sopacua
ort it to my model.py file. Any > help will be appreciated, thanks in advance. Instead of: from django.db import models use: from django.contrib.gis.db import models The gis docs are very informative, try to get the tutorial working first. -- Melvyn Sopacua -- You received this message becaus

Re: AttributeError

2012-08-13 Thread Melvyn Sopacua
On 13-8-2012 14:23, Melvyn Sopacua wrote: > On 13-8-2012 13:47, Satinderpal Singh wrote: > >> I got the following error while making the tables in database using >> syncdb command: >> >> AttributeError: 'DatabaseOperations' object has no attribute &#x

Re: Django: How to get American date format in a form?

2012-08-13 Thread Melvyn Sopacua
#x27;) >>> print form ... ... The reason is in django/conf/locale/en/formats.py. Localize uses the first *_INPUT format available, which happens to be: DATE_INPUT_FORMATS = ( '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006',

Re: Django: How to get American date format in a form?

2012-08-13 Thread Melvyn Sopacua
and it would still be > recognized django/conf/locale/en_GB/ exists. The internationalization modules first look for specific then for the less specific match if it doesn't exist. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django

Re: Django: How to get American date format in a form?

2012-08-13 Thread Melvyn Sopacua
but you need the localize filter or tag: <https://docs.djangoproject.com/en/1.4/topics/i18n/formatting/#controlling-localization-in-templates> -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Django: How to get American date format in a form?

2012-08-13 Thread Melvyn Sopacua
On 13-8-2012 22:41, Melvyn Sopacua wrote: > On 13-8-2012 17:40, houmie wrote: > >> Its just a bit odd that templates show 11:15 p.m. Slight difference in >> the formatting. Also the dates within templates are defined like Aug >> 13, 2012. Doesn't confirm with my def

Re: Using Forms without Request Data

2012-08-13 Thread Melvyn Sopacua
short, initial should be used for 'change forms' and request.POST for the /result/ of that form. -- Melvyn Sopacua -- 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.c

Re: multiple profile

2012-08-13 Thread Melvyn Sopacua
neField(Shared, related_name='client_profile') then you can do: shared_profile = User.get_profile() client_profile = shared_profile.client_profile Or even dynamically, if you make sure shared.type matches extended's related_name: shared_profile = User.get_profile() extended_profile

Re: Using Forms without Request Data

2012-08-13 Thread Melvyn Sopacua
x27;t map correctly by any means. data argument to a form instance must be a dictionary-like object. Other then that there's no requirements. I'm kinda curious why you need a form if you're using a non-html data format. -- Melvyn Sopacua -- You received this message because you are

Re: Using Forms without Request Data

2012-08-13 Thread Melvyn Sopacua
You can save some resources by investing in a JSONForm class and I'm wondering if the following does not do the job: json_object = json.loads(request.POST['fieldname']) obj = MyModel(**json_object) obj.full_clean() obj.save() -- Melvyn Sopacua -- You received this message because y

Re: New to Django, Question about Admin Page

2012-08-13 Thread Melvyn Sopacua
On 14-8-2012 0:15, judy ngai wrote: > Here at the urls.py, the three lines are also uncommented But this one is not: > # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), and should be. -- Melvyn Sopacua -- You received this message because you ar

Re: join models on Timestamp field without foreign keys

2012-08-14 Thread Melvyn Sopacua
related_name='data') data_type = models.ForeignKey(DataType) data = models.DecimalField(max_digits=10,decimal_places=3) > Using a foreign key does't make sense to me since I can't predict that any > particular model will be in every query. If you need y

Re: DJANGO_DEFAULT_SETTINGS

2012-08-14 Thread Melvyn Sopacua
ksh) alias to run that script: alias djmanage='python manage.py' -- Melvyn Sopacua -- 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 th

Re: New to dj: relational limitations

2012-08-14 Thread Melvyn Sopacua
ngo has a choices field attribute. Figuring out the underlying type of the enum would be the challenge, but it makes a lot of sense to populate choices with them. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: 回复: Stuck on "ViewDoesNotExist" last step of tutorial part 4

2012-08-15 Thread Melvyn Sopacua
On 15-8-2012 10:01, Pengfei Xue wrote: > there's no function in views.py, you should define that 'index' > handler No, he's not using it according to source. Which means the source is not in sync with what is being run, typically fixed by restarting the WSGI provider. -

Re: Auto login with external cookie from different system

2012-08-15 Thread Melvyn Sopacua
7;-', 2) hashlib.sha1(settings.SHARED_SECRET == self.secret.lower()) This computes the hash of a boolean. On the whole: take the advice of the python docs library reference: "keep this under your pillow" -- Melvyn Sopacua -- You received this message because you are su

Re: blocktrans inside a with tag

2012-08-15 Thread Melvyn Sopacua
On 15-8-2012 16:26, ernando wrote: > I really didn't try to use blocktrans and with tags together but why do > use val variable value with $ sign? Try just {{val}} one - it works ok for > me. Because it's a monetary ammount? -- Melvyn Sopacua -- You received this mess

Re: blocktrans inside a with tag

2012-08-15 Thread Melvyn Sopacua
w text. Just to make sure no one thinks from my reading my reply that dollar signs formats stuff as monetary ;) On the OP's problem: make sure your translation file kept the format string. The block will end up as: #, python-format msgid "Blah Blah $%(val)" msgstr "...&quo

Re: Calculations in Queries

2012-08-15 Thread Melvyn Sopacua
keep this independent of the database backend I highly suggest you calculate the value in python and store it in the database. Otherwise, I don't see a way to avoid using the extra method: <https://docs.djangoproject.com/en/1.4/ref/models/querysets/#extra> -- Melvyn Sopacua -- You receiv

Re: Where to place Context

2012-08-15 Thread Melvyn Sopacua
n/1.4/intro/tutorial04/#use-generic-views-less-code-is-better> -- Melvyn Sopacua -- 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, se

Re: script for splitting models.py

2012-08-16 Thread Melvyn Sopacua
some of the hard-coded variables and don't need the project variable anymore. - I'm kind of missing the ability to "tell which models go in to which file". If you don't intend to work on this anymore, then by all means, disregard. I was contemplating to make this, but it&#

Re: Auto login with external cookie from different system

2012-08-16 Thread Melvyn Sopacua
On 16-8-2012 6:02, Kurtis Mullins wrote: > Not all of us host the Python docs, locally, haha. Lies! But yea, forgot to check that so thanks :) -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to thi

Re: Editing a form values

2012-08-16 Thread Melvyn Sopacua
lastname = forms.CharField(label=" lastname"); > <https://docs.djangoproject.com/en/1.4/ref/forms/api/#django.forms.Form.initial> initial = { 'email': 'y...@example.com', 'name': 'John', 'lastname': 'Doe', }

Re: script for splitting models.py

2012-08-16 Thread Melvyn Sopacua
On 17-8-2012 1:31, Mike Dewhirst wrote: > On 17/08/2012 4:06am, Melvyn Sopacua wrote: >> On 16-8-2012 11:33, Mike Dewhirst wrote: >> - Perhaps do the same with editor modelines, like the one you have for >> emacs. Vi(m)'s start with either vim: vi: or ex:. > > N

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-16 Thread Melvyn Sopacua
stance: <https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets> -- Melvyn Sopacua -- 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@googleg

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-17 Thread Melvyn Sopacua
you'll need to consult the roll-your-own department or keep looking around for different widgets, for example: <http://www.djangopackages.com/grids/g/widgets/> -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: django makemessages doesn't recognize trans in templates

2012-08-17 Thread Melvyn Sopacua
o the translation instruction in my template > files. This is one of the limitations of the makemessages command. I've ironed out a number of them in a 'projectmessages' management command: http://dpaste.de/QEA9D/ It's a work in progress, but fits my needs for now. YMMV. -

Re: Best way to export data from Django?

2012-08-17 Thread Melvyn Sopacua
data = model_to_dict(instance) print data and you should see the pk there. -- Melvyn Sopacua -- 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 gro

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-18 Thread Melvyn Sopacua
the model you need to pass as the dependent model for inlineformset_factory. So in your case it would be: inlineformset_factory(SalesItem, DealType.sales_item.through, ...) [1] <https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#working-with-many-to-many-models> -- Melvyn Sopacua -- Y

Re: Django + FAPWS doesnt show the templates/view correct

2012-08-18 Thread Melvyn Sopacua
5 latest. > > Nginx - 0.8.54 First of all: mkdir cd /home/test/Desktop/IT_mgmt && python manage.py collectstatic Then in nginx.conf: location /static { alias ; } -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Dj

Re: Not reading from TEMPLATE_DIRS in settings.py

2012-08-18 Thread Melvyn Sopacua
o has now come up with. Compare them with your originals: '/home/madala/WebsiteCode/templates', "/home/madala/Website/templates", -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Redirect to page with query string

2012-08-18 Thread Melvyn Sopacua
cide to put a hidden input in the delete form with the return_to value then obviously it's in request.POST. -- Melvyn Sopacua -- 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@google

Re: Redirect to page with query string

2012-08-19 Thread Melvyn Sopacua
ss-based-views/mixins-editing/#django.views.generic.edit.DeletionMixin> and the method signature for get_success_url() -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-user

Re: skip fixtures loading on 'manage.py test myapp'

2012-08-20 Thread Melvyn Sopacua
at I want is to find a way to tell django skip this fixtures and > instead load some other ones or maybe no fixtures at all for certain tests. > Is it possible? Set the fixtures class attribute on your test class. -- Melvyn Sopacua -- You received this message because you are subscribed to the

Re: Distinct Values in ModelChoiceField

2012-08-20 Thread Melvyn Sopacua
voriteColor(models.Model): > color = models.CharField(max_length=255) > > def __unicode__(self): > return self.color You should invest in fixing the flaw in the design. Set the unique attribute on the color field after you manually remove all duplicates from the database. -- M

Re: Updating a model instance with extra checks.

2012-08-20 Thread Melvyn Sopacua
l are working with the same initial balance, the constraint will deny at least one of them. This is also why you should enclose the entire process (add withdrawal to statement, decrease the balance) in a single transaction. Possibly the @transaction.commit_on_success decorator may prove useful. -- Melvy

Re: new to django

2012-08-21 Thread Melvyn Sopacua
On 21-8-2012 9:27, maha wrote: > i got stuck, after i was running this command *python manage.py shell,* > (i.e) > while exploring the database in python shell. Did you forget the `python manage.py syncdb` part? -- Melvyn Sopacua -- You received this message because you are subs

Re: Distinct Values in ModelChoiceField

2012-08-21 Thread Melvyn Sopacua
ique> By design, the foreign key will now not contain duplicates so distinct is no longer necessary. -- Melvyn Sopacua -- 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.co

Re: GeometryField in OSMGeoAdmin

2012-08-22 Thread Melvyn Sopacua
metryField is like the normal Field class: the base class for actual fields you should be using in your model, like PointField. The docs are not very clear on this issue. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" grou

Re: Can somebody help me on how to handle this scenario?

2012-08-22 Thread Melvyn Sopacua
blem as long as the foreign keys are to different tables. inlineformset_factory will find the foreign key that goes from parent_model to model in it's function signature. It uses _get_foreign_key() in forms/models.py for that. > How do we handle this at the form and template level?

Re: django.db.utils.DatabaseError when resyncing django app models

2012-08-22 Thread Melvyn Sopacua
ions to a model's Meta class. Is there any difference at all between the first and second sync? Or can you reproduce this with an entirely empty database and just run syncdb twice in a row? -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "

Re: runserver error: "No module named app3"

2012-08-22 Thread Melvyn Sopacua
.app3 but app3. I'm reasonably sure that the error is only reported on the last entry because the verification is done in reverse order, but you'll have to look that up in the source. In either case, "the last of the installed apps" is a red herring. -- Melvyn Sopacua -- You

Re: custom field for callable python object like class or function

2012-08-22 Thread Melvyn Sopacua
bject and store the result in a blob-type field or encode it and put it in a TextArea field: <http://docs.python.org/library/pickle.html#pickle> It's basically what the session module is doing. Perhaps look there for inspiration: <https://docs.djangoproject.com/en/1.4/topics/http/session

Re: Layout and global.css files

2012-08-22 Thread Melvyn Sopacua
recurring issue on the list and it's one of those things that has to sink in and then you get it. If you don't get it, then lots of time and energy is wasted on "trying if this works". -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Gro

Re: GeometryField in OSMGeoAdmin

2012-08-23 Thread Melvyn Sopacua
g multiple tables, but I do see many problems trying to make sense of your data if a field is polymorphic. The reason you put stuff into a database is to organize things so you can explore relationships between all the bits pieces. That implies you need to cut things up first. -- Melvyn Sopacua -- You r

Re: django.db.utils.DatabaseError when resyncing django app models

2012-08-23 Thread Melvyn Sopacua
On 23-8-2012 4:53, Mhlanga Bothin wrote: > > On 23/08/2012, at 10:59 AM, Melvyn Sopacua wrote: > >> On 23-8-2012 2:37, Mhlanga Bothin wrote: >> >>> Thanks a lot for your help. I am not adding any classes to the app on >>> the second sync, correct me if

Re: CACHE_MIDDLEWARE_ANONYMOUS_ONLY does not work if user is not printed by view or template

2012-08-24 Thread Melvyn Sopacua
POLA-violation and you should probably file a bug report. I would expect that setting CACHE_MIDDLEWARE_ANONYMOUS_ONLY would call request.user.is_anonymous() and as such load the lazy object. For this to work, the cache middleware should probably be later in the sequence then the authentication midd

Re: Models relationship

2012-08-24 Thread Melvyn Sopacua
ories. If you add other entities like "exporters" and "wholesalers" you're going to need generic relations: <https://docs.djangoproject.com/en/1.4/ref/contrib/contenttypes/#generic-relations> -- Melvyn Sopacua -- You received this message because you are subscri

Re: database file doesn't increase in size

2012-08-24 Thread Melvyn Sopacua
do not grow in size on every new record is because some space is pre-allocated and space previously occupied by deleted records is reused if it fits to prevent large holes (meaning more seeks). -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "D

Re: Using Tag Filters in a generic view

2012-08-24 Thread Melvyn Sopacua
er "record" to be a dictionary containing > all fields within a record. What part of the docs gave you that idea? Maybe it needs clarification. > Is there anyway to get this within the template. def attr_lookup(obj, attr): return getattr(obj, attr, "") register.filter(&#

Re: Layout of widgets in admin form

2012-08-24 Thread Melvyn Sopacua
at gives them your width. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups

Re: Context Help

2012-08-24 Thread Melvyn Sopacua
his is a lot simpeler: <https://docs.djangoproject.com/en/1.4/topics/class-based-views/#adding-extra-context> -- Melvyn Sopacua -- 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@googlegro

Re: Layout of widgets in admin form

2012-08-24 Thread Melvyn Sopacua
jango.contrib.admin.ModelAdmin.fields> Short version: fieldsets = ( (None, { 'fields': ( (question, pub_date), ), } ), #... ) -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "

Re: After form validation, need to post and call a perl program to display to a log file

2012-08-24 Thread Melvyn Sopacua
x27;s perl, you can do this for anything that can be invoked as a "program". -- Melvyn Sopacua -- 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 fr

Re: Why is my groundwork in django show up in 404 page?

2012-08-24 Thread Melvyn Sopacua
ngo-groundwork/management/commands/groundwork.py#L21> @Masud: if you don't get a good answer from users here, you may want to file a ticket with them. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To p

Re: widget construction issue

2012-08-26 Thread Melvyn Sopacua
that get rendered. It's driven by the form field and the form field should be the one managing the available choices. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-user

Re: how to “break” from a regex in urlconf

2012-08-27 Thread Melvyn Sopacua
ics of URLs is to drop the trailing slash for the product. "Back in the day" trailing slashes meant "directory listings" and no trailing slash referred to "document requests" and this applies to your scheme also. So your product url becomes: url(r'^(?P.+)/(?P[

<    1   2   3   4   5   6   7   >