Re: Sponsor subdomain pointing to part of our Django site?

2018-06-05 Thread Richard Brockie
quirement as subdomain.sponsor.url essentially duplicates the /year/slug/ part of the path. There are other parts of our site that we could in future want to associate with other sponsors in a similar manner, so the /year/slug/ must go! Thanks for helping me think this through, -- R. Richard B

Re: Sponsor subdomain pointing to part of our Django site?

2018-06-04 Thread Richard Brockie
visit > https://groups.google.com/d/msgid/django-users/1789736.NRtqCP1Ze9%40fritzbook > <https://groups.google.com/d/msgid/django-users/1789736.NRtqCP1Ze9%40fritzbook?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > --

Re: Sponsor subdomain pointing to part of our Django site?

2018-06-04 Thread Richard Brockie
quot; based on the http_host in the request. I'm wondering if this is a solved problem? Thanks, R. On Mon, Jun 4, 2018 at 6:02 AM Melvyn Sopacua wrote: > On zondag 3 juni 2018 22:45:31 CEST Richard Brockie wrote: > > > Any advice on how I can accomplish this? Any particular thin

Sponsor subdomain pointing to part of our Django site?

2018-06-03 Thread Richard Brockie
Hi, I’m wondering if it is possible to use a subdomain of a sponsor’s url as an alias to a particular part of our Django site? Our Django site has urls of the form: “site.url/year/slug/*” where “*” represents a large set of child pages for various data reports and update actions related to a

Re: Combining querysets while maintaining desired ordering?

2017-06-03 Thread Richard Brockie
7;) > combined = queryset.union(self.many_field2.order_by('some', 'fields')) > > Best, > Simon > > [0] https://docs.djangoproject.com/en/1.11/ref/models/querysets/#union > > Le samedi 3 juin 2017 20:20:11 UTC-4, Richard Brockie a écrit : >> >>

Combining querysets while maintaining desired ordering?

2017-06-03 Thread Richard Brockie
Hi, I am combining querysets of the same model in the following manner: class ExampleModel(models.Model): many_field1 = models.ManyToManyField('Model', related_name='name1') many_field2 = models.ManyToManyField('Model', related_name='name2') def combined_many_fields(self): qs

Re: Filtering a many2many relationship while aggregating?

2016-12-30 Thread Richard Brockie
at 4:49:51 PM UTC-8, Richard Brockie wrote: > > Hi, > > I have the following many2many relationship between 2 models: > > class RaceDay(models.Model): > date = models.DateField() > published = models.BooleanField(default=False) > > class Series(models.Model): &

Filtering a many2many relationship while aggregating?

2016-12-30 Thread Richard Brockie
) \ .filter(year=this_year, published=True) \ .order_by('latest_raceday') The filter here applies to the fields in the Series model. How would I limit the aggregation to members of the many2many relation that have RaceDay.published=True? Thanks, Richard Brockie -- You receive

Re: selectively remove forms from formset in view function

2016-05-22 Thread Richard Brockie
h the larger than I would like file size. On Thursday, May 19, 2016 at 8:18:17 AM UTC-7, Richard Brockie wrote: > > Hi, > > I'm working with pagination of a large formset in my view function. For > forms outside the range to be viewed, I'm currently doing this: &

selectively remove forms from formset in view function

2016-05-19 Thread Richard Brockie
test < range_min: hidden_before.append("%s:%s" % (place_to_test, race_number)) elif place_to_test > range_max: hidden_after.append("%s:%s" % (place_to_test, race_number)) I can't find how to remove the non-visible form from the formset

How to reference previous instance when looping in a template?

2016-03-31 Thread Richard Brockie
Hi, I'm doing a lot of this type of looping in my templates (from the docs: https://docs.djangoproject.com/en/1.9/ref/templates/builtins/#for): {% for athlete in athlete_list %} {{ athlete.name }} {% endfor %} In this context, I find myself occasionally wanting to refer to data of the pr

How to convert modelformset_factory function view to CBV?

2015-12-17 Thread Richard Brockie
pdateView. Any recommendations for how to proceed? Thanks, Richard Brockie -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...

Re: Question about squashing django migrations

2015-08-10 Thread Richard Brockie
Hi Carl, Thanks for pointing this out - it's right there! I don't know how I missed it... Thanks again, R. On Mon, Aug 10, 2015 at 11:12 AM, Carl Meyer wrote: > Hi Richard, > > On 08/01/2015 06:27 PM, Richard Brockie wrote: > > Can someone please explain the implic

Question about squashing django migrations

2015-08-01 Thread Richard Brockie
onfused with the overlapping numbering before/after the squash so I would like to streamline things a little. I'm ok to remove the first set of migrations 0001 to 0052 as they are correctly captured by the first squash. What are your recommendations in a case like this? Thanks! Richa

Re: formset - how to set a from error from formset.clean?

2015-01-29 Thread Richard Brockie
Following up - this did the trick. Thanks for the pointer. R. On Mon, Jan 19, 2015 at 10:40 AM, Richard Brockie wrote: > Thank you - that looks like what I am looking for! I don't know how I > missed that. > > I'm on 1.6 right now - another reason to move to 1.7 :) >

Re: formset - how to set a from error from formset.clean?

2015-01-19 Thread Richard Brockie
[3].add_error('field_name', 'error message') > > > https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.Form.add_error > > Collin > > On Saturday, January 17, 2015 at 10:46:27 PM UTC-5, Richard Brockie wrote: >> >> Hi everyone, >>

formset - how to set a from error from formset.clean?

2015-01-17 Thread Richard Brockie
Hi everyone, In a formset I can use the .clean() method to validate data across the formset. The formset.clean() method is run after all the form.clean() methods - this makes sense. Raising a formset ValidationError alerts the user to the problem with formset.non_form_errors. I would like to a

Re: modelformset question - interspersing extra forms among existing forms

2015-01-12 Thread Richard Brockie
y need to > store a reference to the original race_number to decide if you need to > .save() or not. > > Collin > > On Friday, January 2, 2015 9:42:47 PM UTC-5, Richard Brockie wrote: >> >> Hi Collin, >> >> Thanks very much for the advice. I'll be get

Re: modelformset question - interspersing extra forms among existing forms

2015-01-07 Thread Richard Brockie
; .save() or not. > > Collin > > On Friday, January 2, 2015 9:42:47 PM UTC-5, Richard Brockie wrote: >> >> Hi Collin, >> >> Thanks very much for the advice. I'll be getting to this part of my >> development in the next few days and will report back when I h

Re: Recommendations for hosting service?

2015-01-06 Thread Richard Brockie
I'm using webfaction also - though still shared, they (and others) are much, much better than commodity shared hosting. Apart from the above, the reasons I chose webfaction: 1. Django support, plus: 2. php/MySQL for my existing codebase R. On Tuesday, January 6, 2015 5:44:40 AM UTC-8, B

Re: Expected performance of the django development server?

2015-01-05 Thread Richard Brockie
Hi Jani, That's a correct diagnosis. I knew Django was doing lazy loading, but didn't fully understand the implications. In my case I have a filtered and ordered queryset resulting in ~400 records. Upon processing in the template, each was prompting a database visit 3 times when outputting inf

Expected performance of the django development server?

2015-01-04 Thread Richard Brockie
Hello again, I'm to the point in my django development that I am beginning to use realistic amounts of test data. I'm using postgresql as the database server, with PyCharm as my IDE, everything in a virtualenv on an SSD on an Ivy Bridge Core i7 processor with 16 GB of RAM running Windows 7 64-b

Re: modelformset question - interspersing extra forms among existing forms

2015-01-04 Thread Richard Brockie
number to decide if you need to > .save() or not. > > Collin > > On Friday, January 2, 2015 9:42:47 PM UTC-5, Richard Brockie wrote: >> >> Hi Collin, >> >> Thanks very much for the advice. I'll be getting to this part of my >> development in the ne

Re: modelformset question - interspersing extra forms among existing forms

2015-01-02 Thread Richard Brockie
if entry.pk and not entry.race_number: > entry.delete() > else: > forms = [EntryForm(instance=e, prefix=e.category.pk) for e in > entries] > return render(request, 'template.html', {'athlete': athlete, 'forms': >

modelformset question - interspersing extra forms among existing forms

2014-12-29 Thread Richard Brockie
Hi, I have the following pseudo model that I will use as the basis of a modelformset: class Entry: athlete = ForeignKey(athlete) category = ForeignKey(category) race_number = IntegerField I have a page that displays each athlete's details so the choice of athlete has already been m

Re: simplifying double decorators?

2014-11-30 Thread Richard Brockie
return decorator1(kwarg2='testing')(view) @triple_decorator() def my_view... Thanks very much! R. On Sun, Nov 30, 2014 at 11:48 AM, Arnold Krille wrote: > On Sun, 30 Nov 2014 10:30:29 -0800 Richard Brockie > wrote: > > I'm running into the situation

simplifying double decorators?

2014-11-30 Thread Richard Brockie
ecomes abstracted to something like this: @my_custom_decorator_with_redirects() def some_view... -- R. Richard Brockie <http://www.ontheday.net/> -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this gro

How to abstract model methods to a separate class?

2013-02-26 Thread Richard Brockie
Hi, I have a model along the lines below. I want to be able to define some urls that have a related structure to provide different views of my model. It would be nice to abstract the link generation using a class as these views have wider application. class MyModel(models.Model): date = m