Update name wrapping code

This commit is contained in:
Tobias 2019-01-17 12:35:54 +13:00
parent a5eb814c18
commit aa444a0e94
2 changed files with 9 additions and 9 deletions

View file

@ -1,10 +1,10 @@
from textwrap import wrap
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible
from django_countries.fields import CountryField from django_countries.fields import CountryField
from registrasion import models as rego from registrasion import models as rego
@python_2_unicode_compatible @python_2_unicode_compatible
class PastEvent(models.Model): class PastEvent(models.Model):
''' This is populated in 0001_initial.py ''' ''' This is populated in 0001_initial.py '''
@ -213,7 +213,7 @@ class AttendeeProfile(rego.AttendeeProfileBase):
) )
def first_name(self): def first_name(self):
return " ".join(self.name.split(" ")[:-1]) return wrap(self.name, 15, break_long_words=False)[0]
def last_name(self): def last_name(self):
return self.name.split(" ")[-1] return wrap(self.name, 15, break_long_words=False)[1]

View file

@ -351,10 +351,10 @@
<tspan x="63.592064 67.696709 71.594971 75.140808 79.058128 83.090378 87.033722 90.855789 94.305115 98.148766 102.2896 106.42982 110.32552 114.4651 118.60529 122.77724 126.91492 130.83919 134.60918 138.64143 142.72893 146.85008 150.8963 154.92854" y="78.918243" stroke-width=".35278">{% if ticket_type == "Student" or ticket_type == "Hobbyist" or "Only" in ticket_type %}{% else %}{{ user.attendee.attendeeprofilebase.attendeeprofile.company }}{% endif %}</tspan> <tspan x="63.592064 67.696709 71.594971 75.140808 79.058128 83.090378 87.033722 90.855789 94.305115 98.148766 102.2896 106.42982 110.32552 114.4651 118.60529 122.77724 126.91492 130.83919 134.60918 138.64143 142.72893 146.85008 150.8963 154.92854" y="78.918243" stroke-width=".35278">{% if ticket_type == "Student" or ticket_type == "Hobbyist" or "Only" in ticket_type %}{% else %}{{ user.attendee.attendeeprofilebase.attendeeprofile.company }}{% endif %}</tspan>
</text> </text>
<text transform="matrix(.70476 0 0 .70946 .00070011 86.291)" x="63.592064" y="96.918243" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278"> <text transform="matrix(.70476 0 0 .70946 .00070011 86.291)" x="63.592064" y="96.918243" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278">
<tspan x="63.592064 67.696709 71.594971 75.140808 79.058128 83.090378 87.033722 90.855789 94.305115 98.148766 102.2896 106.42982 110.32552 114.4651 118.60529 122.77724 126.91492 130.83919 134.60918 138.64143 142.72893 146.85008 150.8963 154.92854" y="96.918243" stroke-width=".35278">{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_1 }}</tspan> <tspan x="63.592064 67.696709 71.594971 75.140808 79.058128 83.090378 87.033722 90.855789 94.305115 98.148766 102.2896 106.42982 110.32552 114.4651 118.60529 122.77724 126.91492 130.83919 134.60918 138.64143 142.72893 146.85008 150.8963 154.92854" y="96.918243" stroke-width=".35278">{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_1|truncatechars:35 }}</tspan>
</text> </text>
<text transform="matrix(.70476 0 0 .70946 .00070011 86.291)" x="63.592064" y="103.918243" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278"> <text transform="matrix(.70476 0 0 .70946 .00070011 86.291)" x="63.592064" y="103.918243" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278">
<tspan x="63.592064 67.696709 71.594971 75.140808 79.058128 83.090378 87.033722 90.855789 94.305115 98.148766 102.2896 106.42982 110.32552 114.4651 118.60529 122.77724 126.91492 130.83919 134.60918 138.64143 142.72893 146.85008 150.8963 154.92854" y="103.918243" stroke-width=".35278">{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_2 }}</tspan> <tspan x="63.592064 67.696709 71.594971 75.140808 79.058128 83.090378 87.033722 90.855789 94.305115 98.148766 102.2896 106.42982 110.32552 114.4651 118.60529 122.77724 126.91492 130.83919 134.60918 138.64143 142.72893 146.85008 150.8963 154.92854" y="103.918243" stroke-width=".35278">{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_2|truncatechars:35 }}</tspan>
</text> </text>
<text transform="matrix(.70476 0 0 .70946 .00070011 86.291)" x="160.97801" y="19.488819" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278"> <text transform="matrix(.70476 0 0 .70946 .00070011 86.291)" x="160.97801" y="19.488819" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278">
<tspan x="160.97801 165.03882 169.11363 173.06206 177.1978 181.28149 185.29787 189.22215 193.17758" y="19.488819" stroke-width=".35278">{{ ticket_type|upper }}</tspan> <tspan x="160.97801 165.03882 169.11363 173.06206 177.1978 181.28149 185.29787 189.22215 193.17758" y="19.488819" stroke-width=".35278">{{ ticket_type|upper }}</tspan>
@ -372,19 +372,19 @@
<tspan x="147.10321" y="19.488667" fill="#000000" stroke-width=".35278">{{ pdns_count }}</tspan> <tspan x="147.10321" y="19.488667" fill="#000000" stroke-width=".35278">{{ pdns_count }}</tspan>
</text> </text>
<text transform="matrix(.70476 0 0 .70946 .00070011 86.291)" x="62.309589" y="46.964298" fill="#d35f5f" font-family="sans-serif" font-size="10.583px" letter-spacing="0px" stroke-width=".26458" word-spacing="0px" style="line-height:1.25" xml:space="preserve"> <text transform="matrix(.70476 0 0 .70946 .00070011 86.291)" x="62.309589" y="46.964298" fill="#d35f5f" font-family="sans-serif" font-size="10.583px" letter-spacing="0px" stroke-width=".26458" word-spacing="0px" style="line-height:1.25" xml:space="preserve">
<tspan x="62.309589" y="46.964298" fill="#000000" font-family="Space Mono" font-size="16.933px" letter-spacing=".26458px" stroke-width=".26458">{{ user.attendee.attendeeprofilebase.attendeeprofile.first_name }}</tspan> <tspan x="62.309589" y="46.964298" fill="#000000" font-family="Space Mono" font-size="14.933px" letter-spacing=".26458px" stroke-width=".26458">{{ user.attendee.attendeeprofilebase.attendeeprofile.first_name }}</tspan>
</text> </text>
<text transform="matrix(.70476 0 0 .70946 .00070011 86.291)" x="62.309589" y="67.431442" fill="#d35f5f" font-family="sans-serif" font-size="10.583px" letter-spacing="0px" stroke-width=".26458" word-spacing="0px" style="line-height:1.25" xml:space="preserve"> <text transform="matrix(.70476 0 0 .70946 .00070011 86.291)" x="62.309589" y="67.431442" fill="#d35f5f" font-family="sans-serif" font-size="10.583px" letter-spacing="0px" stroke-width=".26458" word-spacing="0px" style="line-height:1.25" xml:space="preserve">
<tspan x="62.309589" y="67.431442" fill="#1a1a1a" font-family="Space Mono" font-size="16.933px" letter-spacing=".26458px" stroke-width=".26458">{{ user.attendee.attendeeprofilebase.attendeeprofile.last_name }}</tspan> <tspan x="62.309589" y="67.431442" fill="#1a1a1a" font-family="Space Mono" font-size="14.933px" letter-spacing=".26458px" stroke-width=".26458">{{ user.attendee.attendeeprofilebase.attendeeprofile.last_name }}</tspan>
</text> </text>
<text transform="matrix(-.70476 0 0 -.70946 .00070011 86.291)" x="-146.40863" y="-219.08063" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278"> <text transform="matrix(-.70476 0 0 -.70946 .00070011 86.291)" x="-146.40863" y="-219.08063" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278">
<tspan x="-146.40863 -142.304 -138.40573 -134.85989 -130.94258 -126.91032 -122.96698 -119.14491 -115.69559 -111.85194 -107.7111 -103.57088 -99.675179 -95.535606 -91.395416 -87.223465 -83.085785 -79.161507 -75.391518 -71.359261 -67.271767 -63.150616 -59.104397 -55.072155" y="-219.08063" stroke-width=".35278">{% if ticket_type == "Student" or ticket_type == "Hobbyist" or "Only" in ticket_type %}{% else %}{{ user.attendee.attendeeprofilebase.attendeeprofile.company }}{% endif %}</tspan> <tspan x="-146.40863 -142.304 -138.40573 -134.85989 -130.94258 -126.91032 -122.96698 -119.14491 -115.69559 -111.85194 -107.7111 -103.57088 -99.675179 -95.535606 -91.395416 -87.223465 -83.085785 -79.161507 -75.391518 -71.359261 -67.271767 -63.150616 -59.104397 -55.072155" y="-219.08063" stroke-width=".35278">{% if ticket_type == "Student" or ticket_type == "Hobbyist" or "Only" in ticket_type %}{% else %}{{ user.attendee.attendeeprofilebase.attendeeprofile.company }}{% endif %}</tspan>
</text> </text>
<text transform="matrix(-.70476 0 0 -.70946 .00070011 86.291)" x="-146.40863" y="-201.08063" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278"> <text transform="matrix(-.70476 0 0 -.70946 .00070011 86.291)" x="-146.40863" y="-201.08063" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278">
<tspan x="-146.40863 -142.304 -138.40573 -134.85989 -130.94258 -126.91032 -122.96698 -119.14491 -115.69559 -111.85194 -107.7111 -103.57088 -99.675179 -95.535606 -91.395416 -87.223465 -83.085785 -79.161507 -75.391518 -71.359261 -67.271767 -63.150616 -59.104397 -55.072155" y="-201.08063" stroke-width=".35278">{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_1 }}</tspan> <tspan x="-146.40863 -142.304 -138.40573 -134.85989 -130.94258 -126.91032 -122.96698 -119.14491 -115.69559 -111.85194 -107.7111 -103.57088 -99.675179 -95.535606 -91.395416 -87.223465 -83.085785 -79.161507 -75.391518 -71.359261 -67.271767 -63.150616 -59.104397 -55.072155" y="-201.08063" stroke-width=".35278">{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_1|truncatechars:35 }}</tspan>
</text> </text>
<text transform="matrix(-.70476 0 0 -.70946 .00070011 86.291)" x="-146.40863" y="-194.08063" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278"> <text transform="matrix(-.70476 0 0 -.70946 .00070011 86.291)" x="-146.40863" y="-194.08063" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278">
<tspan x="-146.40863 -142.304 -138.40573 -134.85989 -130.94258 -126.91032 -122.96698 -119.14491 -115.69559 -111.85194 -107.7111 -103.57088 -99.675179 -95.535606 -91.395416 -87.223465 -83.085785 -79.161507 -75.391518 -71.359261 -67.271767 -63.150616 -59.104397 -55.072155" y="-194.08063" stroke-width=".35278">{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_2 }}</tspan> <tspan x="-146.40863 -142.304 -138.40573 -134.85989 -130.94258 -126.91032 -122.96698 -119.14491 -115.69559 -111.85194 -107.7111 -103.57088 -99.675179 -95.535606 -91.395416 -87.223465 -83.085785 -79.161507 -75.391518 -71.359261 -67.271767 -63.150616 -59.104397 -55.072155" y="-194.08063" stroke-width=".35278">{{ user.attendee.attendeeprofilebase.attendeeprofile.free_text_2|truncatechars:35Schulmannnnnn }}</tspan>
</text> </text>
<text transform="matrix(-.70476 0 0 -.70946 .00070011 86.291)" x="-49.022686" y="-278.51004" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278"> <text transform="matrix(-.70476 0 0 -.70946 .00070011 86.291)" x="-49.022686" y="-278.51004" fill="#100f0d" font-family="Space Mono" font-size="6.35px" stroke-width=".35278">
<tspan x="-49.022686 -44.96188 -40.887066 -36.938641 -32.802898 -28.719202 -24.702829 -20.778543 -16.823114" y="-278.51004" stroke-width=".35278">{{ ticket_type|upper }}</tspan> <tspan x="-49.022686 -44.96188 -40.887066 -36.938641 -32.802898 -28.719202 -24.702829 -20.778543 -16.823114" y="-278.51004" stroke-width=".35278">{{ ticket_type|upper }}</tspan>

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB