Re: #29433 New split template filter

2018-05-30 Thread Collin Anderson
There's been a few cases where I would have found a split filter to be useful. I don't remember them off the top of my head. I like that the behavior of it should be pretty well defined: just return obj.split() if val is None else obj.split(val) On Wed, May 30, 2018 at 6:32 AM, Carlton Gibson wr

Re: Spaces between argument separator and argument in template filter generate error

2018-05-31 Thread Collin Anderson
Maybe it would be worth having a more friendly error message? On Thu, May 31, 2018 at 8:59 PM, wrote: > Thank you for your reply. > I understand your opinion well > > 2018년 5월 31일 목요일 오전 11시 41분 22초 UTC+9, oli...@kidsnote.com 님의 말: >> >> In the template filter system now, >> >> spaces between au

Re: Redirect using HTTP status "303 See Other"

2018-06-04 Thread Collin Anderson
I don't think we should make any changes to HttpResponseRedirect, for backwards compatibility reasons if nothing else. It might make sense to encourage people to use HttpResonse(status=303) directly, rather than using subclasses. On Mon, Jun 4, 2018 at 3:51 PM, Duane Hutchins wrote: > The "302

Re: New Feature discussion: making admin app & model url configurable

2018-06-29 Thread Collin Anderson
Maybe we could make an AdminSite.get_urls_for_model(self, model, model_admin) https://github.com/django/django/pull/10108/files On Fri, Jun 29, 2018 at 8:57 AM wrote: > Personally, I'm not sure I see that much value. As I see it, the admin is > intended for technical users, not as a general adm

Re: Re: The behavior of QueryDict.get(_key_, _default=None_)

2018-07-19 Thread Collin Anderson
Using your example, the client is sending this string: ?wordPos=2&wordPos=3 It's not an array like ?wordPos=2,3 On Thu, Jul 19, 2018 at 10:27 PM Zhao Lee wrote: > I have to confess I don’t know much about web development . > > I used to expect QueryDict.get(_key_, _default=None_) to return dat

Re: Re: The behavior of QueryDict.get(_key_, _default=None_)

2018-07-19 Thread Collin Anderson
You might want to try json encoding your data if you want to preserve integers, lists, etc. On Thu, Jul 19, 2018 at 10:54 PM Collin Anderson wrote: > Using your example, the client is sending this string: > > ?wordPos=2&wordPos=3 > > It's not an array like ?wordPos=2,3

Re: python manage.py inspectdb makes all fields with a default value blank=True, null=True

2018-07-22 Thread Collin Anderson
It's tricky to automatically convert the database default value to python, but I wonder if it would help to put the default value in a python comment at the end of the field? like: models.IntegerField(blank=True, null=True) # DB Default value: 1 That way it's more clear in models.py what's going

Re: HTML5 and XHTML5 documents

2018-08-17 Thread Collin Anderson
> serve Django Admin as 'text/html', and let other apps choose for themselves. Yes, DEFAULT_CONTENT_TYPE is deprecated, so the admin (soon) should always return text/html, and other apps can choose for themselves. (see ticket #23908 ) I think django sho

Re: #29752 Adding a ALLOWED_HOSTS_IGNORABLE_URLS setting

2018-09-14 Thread Collin Anderson
You might be able to handle this by a middleware that gets called early enough in the process (before CommonMiddleware) to avoid calling request.get_host(). A simple if request.path == '/statuscheck/': return HttpResponse() should work. As long as you never call request.get_host(), django doesn't a

Re: Make `raw_id_fields` the default functionality in the admin

2018-10-17 Thread Collin Anderson
raw_id_fields can be a bit confusing to people. Have you tried the new autocomplete_fields? It's almost as easy to use as a select field, and it should help solve the problem. However, it's not as easy to make the default (because it requires specifying search_fields on the related model) On Wed,

Ticket/Issue Tracker

2018-10-26 Thread Collin Anderson
A few years ago I realized I really liked the UI of Trello.com, so I tried creating a trello-style view of django tickets: https://djello.collinand.org/ (beware, I'm not a designer :) It's basically just 100 lines of JS and a little CSS. It's still my go to for finding tickets. I thought I'd s

Re: Idea: Allow queryset.get() and queryset.filter() to accept a positional argument for implicit primary key filtering

2018-11-07 Thread Collin Anderson
You could probably also just monkey patch like so: from django.db.models import Manager, QuerySet Manager.ident = QuerySet.ident = lambda self, pk: self.get(pk=pk) On Wed, Nov 7, 2018 at 3:33 PM C. Kirby wrote: > I bit the bullet and put together a small app to handle this, with maybe > even le

Re: Simplify authentication backend interface

2018-11-12 Thread Collin Anderson
> Add default implementations for get_all_permissions() and has_perm(), either in PermissionMixin or in a new BaseBackend class. On a first glance, I think that makes sense to me. > Also note that the separation between user and group permissions may not be applicable with custom backends. That al

Re: Allow skipping CSRF check for Referer header

2018-11-12 Thread Collin Anderson
Aas a data point, I've customized my csrf checking to skip the referrer checking if there's a correct origin header. Though yes, it doesn't work in some browsers. (I haven't set up Referrer-Policy so that hasn't been an issue for me yet.) I think it's worth mentioning too that same-site cookies ar

Re: normalizing newlines in form fields

2018-11-12 Thread Collin Anderson
Maybe the newline character could be part of the setting, something like normalize_newlines_to='\n'. And then just do a normalize_newlines_to.join(value.splitlines()) could work. On Mon, Nov 12, 2018 at 10:49 AM Jakub Kleň wrote: > Regarding the link you sent, I also think that the current behav

Re: New to open source community

2018-12-18 Thread Collin Anderson
Hi Pradeep, You could try also joining the #django-dev irc channel. Also checkout the "Advice for new contributors" if you haven't yet: https://docs.djangoproject.com/en/dev/internals/contributing/new-contributors/ Thanks, Collin On Sun, Dec 16, 2018 at 2:18 PM Pradeep Sukhwani wrote: > Hi t

Re: RFC: #30053 Allow for conditional QuerySet.update_or_create()

2019-01-02 Thread Collin Anderson
Seems to me a documentation example or improvement could be helpful. On Mon, Dec 31, 2018 at 11:30 AM Joshua Cannon wrote: > Personally, the snippet suggested in the ticket is sufficient for my needs > (although I'm saddened by having to duplicate the setattr logic). > However, I filed the ticke

Re: [Looking for feedback] Make Admin raw_id_fields the default choice for FKs, or project-wide configurable

2019-01-17 Thread Collin Anderson
I agree that default load-all-options is an annoying default. I just ran into this problem again myself in the last few weeks. One problem with any of the alternatives (besides making it readonly by default) is that it requires the other model to be registered in the admin, which could be also be a

Re: [Looking for feedback] Make Admin raw_id_fields the default choice for FKs, or project-wide configurable

2019-01-18 Thread Collin Anderson
els can have >>>> different names. I can't just write one global ModelAdmin and then use it >>>> for all my models, because they'll have different names for their fields. >>>> Or if it works, it'll need A LOT of introspection (to dynamically check >

Re: revisiting the Python version support policy

2019-01-22 Thread Collin Anderson
Now that we've dropped Python 2, I personally wouldn't mind having the policy be to support all supported versions of python (except 2.7) at the time of each Django release. So Django would drop just after Python drops. (The most recent version of Django (and maybe LTS too) should probably also add

Re: Automating the process of creating models from the data file provided

2019-02-07 Thread Collin Anderson
Hi Abhilasha, This is ringing a bell. I almost started working on an "inspectfile" feature many years ago as a Google Summer of Code project. https://groups.google.com/d/topic/django-developers/z88grOaxEHU/discussion https://groups.google.com/d/topic/django-gsoc/V9FdRVZ7gMg/discussion I ended u

Re: include only columns from selected related models in select_related query

2019-02-11 Thread Collin Anderson
So would you "defer" the other columns like "only()"? If nothing else, you could try using .annotate(F('author__hometown')) (not sure if that works) or .values('author__hometown') to just get the values you need. On Mon, Feb 11, 2019 at 5:50 AM Riccardo Magliocchetti < riccardo.magliocche...@gmai

Re: Password reset emails in combination with click tracking do not work with Intelligent Tracking Prevention on Safari for iOS 12 and macOS Mojave

2019-02-22 Thread Collin Anderson
I wouldn't mind just rolling back the security fix (or maybe making a straightforward way to enable/disable the behavior). We could instead encourage people to use on any links (from the password rest page) to untrusted urls. On Friday, February 22, 2019 at 5:03:01 AM UTC-5, Henrik Ossipoff Ha

More standard template filters

2019-04-04 Thread Collin Anderson
Hi All, I use django templates a lot and I always wished there was a myvar|startswith:"teststring", myvar|endswith:"teststring" and a myvar|contains:"teststring" filter. I instead do stuff like myvar|slice:":10" == "teststring" which is a total hack. Is this something that could be simple and

Re: Specifying model relationship as string vs concrete model class

2019-04-07 Thread Collin Anderson
models.Foreignkey(User) is a more pythonic and allows more better analysis by tools like flake8, but in some cases you need to create the ForeignKey before User is defined, so you _have_ to use a string. Example: https://docs.djangoproject.com/en/stable/ref/models/fields/#foreignkey On Sat, Apr 6

Re: 2020 Authentication Initiativ

2019-04-10 Thread Collin Anderson
Email + password auth is definitely a wanted feature out-of the box, and probably a good first step would be to create a separate AbstractEmailUser or something like that. Seems to me AbstractUser shouldn't be changed for backwards compatibility reasons, but maybe something like a BaseAbstractUser

Re: Proposal: Allow ManyToMany using a intermediary table to be defined as symmetrical

2019-05-08 Thread Collin Anderson
d this one which is > kind of related https://code.djangoproject.com/ticket/9475 > And you can see in the PR some discussion about the check > https://github.com/django/django/pull/8981#discussion_r247946460 > Thanks to the work of Collin Anderson in the previous PR I think we can >

Re: deprecating the "escape" half of django.utils.safestring (#24046)

2016-03-09 Thread Collin Anderson
This makes sense to me. mark_for_escaping() seems like a no-op to me. On Sat, Mar 5, 2016 at 11:16 AM, Tim Graham wrote: > Aymeric raised this ticket [0] while working on multiple template engines: > > > "Since any data that isn't explicitly marked as safe must be treated as > unsafe, I don't un

Re: deprecating the "escape" half of django.utils.safestring (#24046)

2016-03-09 Thread Collin Anderson
Ohh. Nevermind. Sorry for not reading the whole thing. I forgot about the {% autoescape off %} case. On Wed, Mar 9, 2016 at 10:11 PM, Collin Anderson wrote: > This makes sense to me. mark_for_escaping() seems like a no-op to me. > > On Sat, Mar 5, 2016 at 11:16 AM, Tim Grah

Re: Translate permission Django

2016-03-14 Thread Collin Anderson
Maybe we could have __str__ run the text through _()? I don't do much translating. On Mon, Mar 7, 2016 at 10:21 AM, Tim Graham wrote: > This has been discussed in several tickets ( > https://www.google.com/search?&q=translate+permissions+site%3Acode.djangoproject.com) > and mailing list threads

Re: Override the default form field for a model field

2016-03-18 Thread Collin Anderson
A few thoughts, just to see if we can solve the problem by documenting some existing code: Would making a subclass overriding formfield() work? class RadioSelectBoolean(models.BooleanField): def formfield(self, *args, **kwargs): kwargs['widget'] = forms.RadioSelect super(Radio

Re: Revisiting multiline tags

2016-03-18 Thread Collin Anderson
Here's the actual code PR https://github.com/django/django/pull/2556 On Sun, Mar 13, 2016 at 1:26 AM, Martijn van Oosterhout wrote: > > On 12 March 2016 at 05:31, Curtis Maloney wrote: > > I think this conversation needs to come to a conclusion, and that >>> conclusion should be simple. Several

Re: Proposal: change to the way list_editable form data is submitted in the admin

2016-03-19 Thread Collin Anderson
I could see this feature being helpful. (Submitting the original data and comparing it to be sure we don't silently have a merge conflict). On Wed, Mar 16, 2016 at 11:14 PM, John C wrote: > Thanks. #11652 is a good description of the same problem in the context of > the "change" page. I think th

Re: [GSOC] Original Idea/Seeking Mentor: Conditions API (Related to Auth)

2016-03-19 Thread Collin Anderson
Hi Connor, I personally usually avoid class based views whenever possible and stick to function based views whenever possible. Would these Conditions be usable within function based views too? Thanks, Collin On Thursday, March 17, 2016 at 8:00:16 AM UTC-4, Connor Boyle wrote: > > My original

Re: relative path in {% extends "...base.html" %} like relative import

2016-03-20 Thread Collin Anderson
Hmm... I suppose the closest alternative we have would be to store the base template name in a variable and pass it in from the view. On Fri, Mar 18, 2016 at 12:42 PM, Vitaly Bogomolov wrote: > Hi, All. > > For django.template.backends.django.DjangoTemplates (filesystem and > app_directories) it

Re: Add HTML5 required attribute on form widgets

2016-03-29 Thread Collin Anderson
Hi All, I think things are kind of quiet because djangocon.eu is starting tomorrow. My opinion: In the past we changed things to use html5 types (number, email, url, etc) and we didn't use a deprecation warning in those cases, just mentioned it in the release notes. I'm sure it will break some pe

Re: A helpful ImportError for manage.py when Django isn't installed/available

2016-04-03 Thread Collin Anderson
We could also wait til after we remove py2 support in January. That way we can be sure that on py3 it will also print the original exception so it doesn't get hidden. (Right?) On Fri, Apr 1, 2016 at 6:23 AM, Shai Berger wrote: > An idea: Catch the exception; in the handler, try to simply "import

Re: Vendoring Select2

2016-04-06 Thread Collin Anderson
Hi All, I'm in favor of this change. This has the potential to replace the raw_id_fields and filter_horizontal which I think would be a huge win. Those widgets are out-dated not only in terms of code, but also from a UI point of view. I'll try to give my answers to some questions before they c

Re: Add HTML5 required attribute on form widgets

2016-05-05 Thread Collin Anderson
If anyone is running into hidden required fields preventing forms from submitting (like me), I've been using this jQuery code for a somewhat-hacky quickfix: $(':hidden[required]').removeAttr('required') On Saturday, April 2, 2016 at 12:27:28 PM UTC-4, Jon Dufresne wrote: > > On Wed, Mar 30, 201

Re: Add HTML5 required attribute on form widgets

2016-05-05 Thread Collin Anderson
orm to validate against. (Login vs Create account, Checkout vs Apply promo code, Use a saved address or add new address, etc.) Thanks, Collin On Thu, May 5, 2016 at 2:34 PM, Jon Dufresne wrote: > On Thu, May 5, 2016 at 11:29 AM, Collin Anderson > wrote: > >> If anyone is runni

Re: Autocomplete in Django 1.11: Widget in Forms Library?

2016-09-30 Thread Collin Anderson
Hi, "it could be possible to provide such a widget in contrib.admin". The current PR provides a django.contrib.admin.widgets.AutocompleteSelect widget. Does that work? You could subclass it to use a different URL instead of the built-in admin:autocomplete url if needed. My one worry is that if w

Re: Provide a simpler way to default runserver IP/port to 0.0.0.0:8000

2016-12-23 Thread Collin Anderson
If it helps, there's a also a shortcut: ./manage.py runserver 0:8000. Much easier to type. On Mon, Nov 28, 2016 at 8:48 AM, wrote: > This was filed as https://code.djangoproject.com/ticket/27537 , but > moving here for discussion. > > We have the following use case: > * An app uses a VM for the

Re: Responsive admin

2017-01-10 Thread Collin Anderson
I think for the admin fonts, we put those in a separate css file: fonts.css, so you could easily disable them by replacing that file with a blank file. We could probably do the same thing with a responsive.css file. (Though if we do give the option to switch, do we now need to support and test eve

Re: Removing and renaming Django's Python 2 related helpers

2017-01-30 Thread Collin Anderson
Hi All, django.utils.six _is_ documented, so I think it should go through the normal deprecation timeline. https://docs.djangoproject.com/en/1.11/topics/python3/#writing-compatible-code-with-six Seems fine to me to start the deprecation in 2.0, but I'm sure people would appreciate starting the t

Re: Add ability to choose a different secret for PasswordResetToken

2017-03-18 Thread Collin Anderson
"the self-service site is basically a small subset of our internal site. So if somebody would gain access to our interal site, he/she would already have access to a superset of data of the other site. So there is really no point to also take over to the other site." Just curious: why not just use

Re: Provide forms field/widget type information for use in templates

2017-03-20 Thread Collin Anderson
Hi, If it helps It looks like there's a widget.input_type attribute, so you can at least do {% if theform.thefield.field.widget.input_type == "checkbox" %} etc. Collin On Mon, Mar 20, 2017 at 9:46 AM, Paweł Adamczak wrote: > Hiya, > > I would like to 'resurrect' ticket #13009 >

Re: I would like to discuss my proposal for a working way to call .add() on an m2m with through= model

2017-03-20 Thread Collin Anderson
Hi, Check out https://code.djangoproject.com/ticket/9475 Seems like it would be fine if Django allowed add() and let any errors about missing data bubble-up. I personally think passing in a defaults dict (just like get_or_create does) would also be fine, but a callback seems like overkill. Here'

Re: Deprecate is_superuser, is_staff and is_active

2017-03-24 Thread Collin Anderson
Hi Thomas, "If the user should have all permissions, then why not give him all these permissions at database level?" - I have some use cases where there are only 3-5 people that need to log into the admin. I don't really need to set different levels of access for different people. I also don't wan

Re: Add better support for ManyToMany with intermediary table fields, and reverse relationships, specially in forms

2017-03-30 Thread Collin Anderson
Hi Gabriel, Yes, the hope is to make the situation better and more standard. Here's some of the status: https://code.djangoproject.com/ticket/24317 - real reverse fields. https://code.djangoproject.com/ticket/897 - real reverse many to many fields https://code.djangoproject.com/ticket/12203 - many

Re: Proposal: make Model __unicode__() default to self.name

2017-04-02 Thread Collin Anderson
g "pk" in Model string > representation if it exists. > > On Thursday, 11 July 2013 09:16:25 UTC+5:30, Collin Anderson wrote: >> >> Hi All, >> >> Have you ever quickly set up a model, ran syncdb, and added a few sample >> objects in the admin to only see a bu

Re: Proposal: make Model __unicode__() default to self.name

2017-04-03 Thread Collin Anderson
w: Should it be 'ClassName object > pk=Something' and if pk is None then should it be 'ClassName object > (unsaved)' or 'ClassName object pk=None' ? > > On Sunday, 2 April 2017 23:47:01 UTC+5:30, Collin Anderson wrote: >> >> Makes sense to me. Maybe

Re: Proposal: make Model __unicode__() default to self.name

2017-04-07 Thread Collin Anderson
py >> @@ -504,7 +504,7 @@ class Model(metaclass=ModelBase): >> return '<%s: %s>' % (self.__class__.__name__, u) >> >> def __str__(self): >> -return '%s object' % self.__class__.__name__ >> +return '%s object pk=

Re: Proposal: make Model __unicode__() default to self.name

2017-04-08 Thread Collin Anderson
gt; diff --git a/django/db/models/base.py b/django/db/models/base.py >>>>> index 3c1cb9a..f58e12b 100644 >>>>> --- a/django/db/models/base.py >>>>> +++ b/django/db/models/base.py >>>>> @@ -504,7 +504,7 @@ class Model(metaclass=ModelBase): >>

Re: A New Design for the "Congratulations!" Page

2017-04-18 Thread Collin Anderson
Beautiful. The Google Font should not be an issue. We're already distributing that as part of the admin, which is installed by default. The page could just reference /static/admin/css/fonts.css. Does a license need to be included for the rocket animation, or is that your own work? I hope the lin

Re: A New Design for the "Congratulations!" Page

2017-04-18 Thread Collin Anderson
I was also reminded of green color the green color discussion. >From the discussion about the admin redesign [0][1]: "makes keeping a visual identity for Django hard to separate from the admin UI" "the admin is part of _your_ site, not ours, and so should have a visually-distinct theme/brand that

Re: Django test suite taking > 2 hours, gets stuck, have to Ctrl-C

2017-04-22 Thread Collin Anderson
Hi Dylan, Was there a traceback when you pressed ctrl+c? That might show where it's getting stuck. You could try using --parallel=1 to disable multi-process which might also give you some more information. (And does the test suite run fine without your patch? :) I assume you're testing using th

Re: Admin and CSS Custom Properties

2017-04-28 Thread Collin Anderson
I suggest supporting IE11+, as that's the latest on Windows 7 and there's not much 9-10 usage. Now's probably a good time to bump them if needed because we're just past an LTS. Though, yes, it doesn't allow CSS variables. On Fri, Apr 28, 2017 at 6:38 AM, Curtis Maloney wrote: > I recently disco

Re: [JOB POST] Django backend developer per Centre Comune di Ricerca - JRC

2017-05-23 Thread Collin Anderson
(Django-users is a better place for job postings: https://groups.google.com/d/forum/django-users ) On Tue, May 23, 2017 at 5:17 PM, Aymeric Augustin < aymeric.augus...@polytechnique.org> wrote: > Hello Jorge, > > Job postings are inappropriate on this mailing list. > > Thanks for your understandi

Re: Value of tightening URLValidator/EmailValidator regular expressions?

2017-05-31 Thread Collin Anderson
Hi All, There's a PR [0] to make validation match HTML. Though there's a question about what to do with domain_whitelist. Here's the background: - Originally Django didn't allow any dotless (non-FQDN) domain names. - People wanted to use "localhost", but the SMTP spec said "Local nicknames or

Re: Default to BigAutoField

2017-06-09 Thread Collin Anderson
I might be wrong, but if the default changes, won't the migrations detect it and migrate it just fine, including foreign keys? All of my migrations have this: ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), So everyone would either need to manual

Re: Admin actions.js performance

2017-08-04 Thread Collin Anderson
I can confirm it's slightly faster in my case (maybe 20-50ms for 58 rows, 3 inputs per row). I can get it ~15ms faster by making it just one event handler, though it's a bigger change: $('#result_list').on('change', 'td:nth-child(n+2) :input', function() { On Fri, Aug 4, 2017 at 7:29 AM, ecas wr

Re: #2507 LDAP Auth

2008-01-25 Thread Collin Anderson
> *The issue with where documentation should go -- I threw together a > patch for the auth doc in django/docs/, but the auth document is already > long. Does the documentation want to live somewhere else, or is it happy > there? How about a docs/auth_backends.txt? Collin --~--~-~--~

GSoC Proposal: Auto-generation of Models from Data

2008-03-28 Thread Collin Anderson
Hello, My name is Collin Anderson and I am interested in participating in Google Summer of Code for django. I am a junior at the University of Minnesota studying computer science. My idea is inspired by a suggestion on the 2006 Summer of Code ideas list: "add dabbledb (http://dabbledb.co

Re: GSoC Proposal: Auto-generation of Models from Data

2008-03-28 Thread Collin Anderson
Hi Jacob, > My main point of feedback is that you're dealing with a *HUGE* problem > -- dabbledb represents literally years of work, and trying to > reproduce that in a single summer is seriously unrealistic. Yes, I realize that the types of migrations that dabbledb does are currently not ver

<    1   2   3