django.db.models.functions.RTrim - python examples

Here are the examples of the python api django.db.models.functions.RTrim taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

3 View Complete Implementation : test_trim.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_trim(self):
        Author.objects.create(name='  John ', alias='j')
        Author.objects.create(name='Rhonda', alias='r')
        authors = Author.objects.annotate(
            ltrim=LTrim('name'),
            rtrim=RTrim('name'),
            trim=Trim('name'),
        )
        self.astertQuerysetEqual(
            authors.order_by('alias'), [
                ('John ', '  John', 'John'),
                ('Rhonda', 'Rhonda', 'Rhonda'),
            ],
            lambda a: (a.ltrim, a.rtrim, a.trim)
        )