Re: Question about dot notation syntax (Django source)

2018-02-15 Thread Juan Pablo Romero Bernal
Hi,

You must read: https://docs.python.org/3/tutorial/modules.html

and

https://docs.python.org/3/tutorial/datastructures.html#dictionaries

Cheers,


On Thu, Feb 15, 2018 at 8:06 PM, drone4four  wrote:

> In, “Password management in Django
> ”,
> it explains that this particular doc is for advanced users, like Django
> admins who need to choose different hashing algorithms.  So it’s not really
> necessary for a beginner user like me to understand.  From the doc:
>
> ...depending on your requirements, you may choose a different algorithm,
>> or even use a custom algorithm to match your specific security situation.
>> Again, most users shouldn’t need to do this – if you’re not sure, you
>> probably don’t. If you do, please read on...
>
>
> I don’t. So I don’t need to continue reading.
>
> But I do have some questions about dot notation in general as some code
> appears in settings.py. Lines 87 - 100 in this file appear as follows:
>
> AUTH_PASSWORD_VALIDATORS = [
> {
> 'NAME': 'django.contrib.auth.password_validation.
> UserAttributeSimilarityValidator',
> },
>
> {
> 'NAME': 'django.contrib.auth.password_validation.
> MinimumLengthValidator',
> },
>
> {
> 'NAME': 'django.contrib.auth.password_validation.
> CommonPasswordValidator',
> },
>
> {
> 'NAME': 'django.contrib.auth.password_validation.
> NumericPasswordValidator',
> },
> ]
>
>
>
> Can someone please identify the first item in this list?  I understand
> that all the items in this list are dictionaries.  The first dictionary is
> named, ‘NAME’.  The key involves libraries, functions, variables, class
> names and more functions.  Which is which? Is `django` the library? What is
> `contrib`? Is this a function name or a class name?  If `contrib` is a
> function name or class name, where is it located in my venv or Django
> project folder?
>
> What does each word in the dictionary mean or refer to?  Can some one
> please explain the syntax?
>
> Thanks for your attention.
>
> --
> 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...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/e285f69d-3aad-4d99-b46e-7f6be5ccbffb%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Juan

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJK1Jg26MJz2xHYQyH7EdH44EmoUNcdW1D%2BMOfGtmeq4yr8Z9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Question about dot notation syntax (Django source)

2018-02-15 Thread drone4four


In, “Password management in Django 
”,
 
it explains that this particular doc is for advanced users, like Django 
admins who need to choose different hashing algorithms.  So it’s not really 
necessary for a beginner user like me to understand.  From the doc:

...depending on your requirements, you may choose a different algorithm, or 
> even use a custom algorithm to match your specific security situation. 
> Again, most users shouldn’t need to do this – if you’re not sure, you 
> probably don’t. If you do, please read on...


I don’t. So I don’t need to continue reading. 

But I do have some questions about dot notation in general as some code 
appears in settings.py. Lines 87 - 100 in this file appear as follows:

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 
'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},

{
'NAME': 
'django.contrib.auth.password_validation.MinimumLengthValidator',
},

{
'NAME': 
'django.contrib.auth.password_validation.CommonPasswordValidator',
},

{
'NAME': 
'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]



Can someone please identify the first item in this list?  I understand that 
all the items in this list are dictionaries.  The first dictionary is 
named, ‘NAME’.  The key involves libraries, functions, variables, class 
names and more functions.  Which is which? Is `django` the library? What is 
`contrib`? Is this a function name or a class name?  If `contrib` is a 
function name or class name, where is it located in my venv or Django 
project folder? 

What does each word in the dictionary mean or refer to?  Can some one 
please explain the syntax?

Thanks for your attention.

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e285f69d-3aad-4d99-b46e-7f6be5ccbffb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


modelform selection options

2018-02-15 Thread sum abiut
I have a model.py
class selection(models.Model):
select=(
(A','A'),
('B','B'),
('C','C'),


)

options=models.CharField(max_length=7,choices=select)


and form.py

class order(forms.ModelForm):
class Meta:
model=selection
fields=('Pay_options,)


I want to write a view.py that check the form for the choice that is
selected but i don't know how to get started. for example if a user select
option A, i want to perform some query. I want to know how to check for the
options that are selected before i can performing a query. Appreciate any
assistances.

cheers,

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y5UoHSSK0pPMwuzSyStwgj9fpmPF%3DLRaKFbfNZuQbTfAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Chat with DjangoChannels and DRF

2018-02-15 Thread Darwin Vasquez
I'm trying to make a chat on real time for the web.

 I was playing  with Django-Channels, and it seems to me that works fine. 

But now, I'm not sure. I need to make the chat over an api on REST. 

For that, I will using DRF, and to render the data I would make the website 
on another instance.

So basically a api with DRF (that serves the chat, and store the messages) 
and a website (on django too) that render the data, (this on another  
instance).


My Question is. Channels works for this case?. Where do I need to work the 
websocket, and Install django-Channels, Daphne and Redis? On the DRF or the 
website?. What is the aproach to do it? please some help.

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0d80adf0-b7fe-4f74-b79e-976be8a0d43b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Create objects using a start date, an end date and time list

2018-02-15 Thread Kakar Nyori
I have an Event model, and each event will have different shows.

class Event(models.Model):
title = models.CharField(max_length=200)

class Show(models.Model):
event = models.ForeignKey(Event, on_delete=models.CASCADE)
date_time = models.DateTimeField(unique=True)

class Ticket(models.Model):
show = models.ForeignKey(Show)
seat = models.ForeignKey(Seat)

class Meta:
unique_together = ('show', 'seat')

I need to create shows based on the start date and end date provide by the 
user. Suppose this is a JSON post:

{
"event_id": 1,
"start_date": "2018-02-16",
"end_date": "2018-02-20",
"time_list": ["11:00 AM", "8:00 PM"]
}

>From the above JSON example, I need to create Show starting like this:

# Start with the start_date as the date, and for each time from the 
time_list
Show.objects.create(
event = 1,
date_time = datetime.strptime('2018-02-16 11:00 AM', "%Y-%m-%d 
%I:%M %p")
)
Show.objects.create(
event = 1,
date_time = datetime.strptime('2018-02-16 8:00 PM', "%Y-%m-%d %I:%M 
%p")
)
# Next date after the start_date, i.e., 16+1 = 17
Show.objects.create(
event = 1,
date_time = datetime.strptime('2018-02-17 8:00 PM', "%Y-%m-%d %I:%M 
%p")
)
.
.
.
# Create Show objects till the end_date and for each time from the 
time_list
Show.objects.create(
event = 1,
date_time = datetime.strptime('2018-02-20 8:00 PM', "%Y-%m-%d %I:%M 
%p")
)

Right now this is how I am creating Show objects:

def create_show_by_datetime(self, request):
event_id = request.data['event_id']
start_date = request.data['start_date']
end_date = request.data['end_date']
time_list = request.data['time_list']

format = '%Y-%m-%d'
delta_days = datetime.strptime(end_date, format).date() - 
datetime.strptime(start_date, format).date()
delta_days = delta_days.days + 1

for i in range(delta_days):
day = datetime.strptime(start_date, format) + timedelta(days=i)
for i in range(len(time_list)):
hrs = datetime.strptime(time_list[i], "%I:%M %p").hour
mins = datetime.strptime(time_list[i], "%I:%M %p").minute
event = Event.objects.get(id=event_id)
dt = day + timedelta(hours=hrs, minutes=mins)
show = Show.objects.create(
event=event,
date_time=dt
)

But I am really hoping there's much more elegant way than how I am doing. I 
am using python 3, django 2 and django rest frameowork. Could you please 
help me?

Thank you

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/813ca752-f1e1-47d7-9ebb-a8bdb7e2ed59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to do "choices" from DB in form field without breaking migrations and such

2018-02-15 Thread C Kirby
Yeah, I meant to write about that. If you put a database filter in a field
definition (model or form) it only runs it on start/restart. Using the
method I put, or a callback function in the choices, allows the choices to
reflect reality of the data.

On Thu, Feb 15, 2018 at 12:24 PM,  wrote:

> Thank you very much.  This worked perfectly.  Consequently it also fixed
> my issue of those select boxes not reflecting changes in the list until the
> web server was restarted since the data is now being pulled at
> instantiation instead of in the class definition.
>
> j
>
>
>
> On Thursday, February 15, 2018 at 9:54:24 AM UTC-6, C. Kirby wrote:
>>
>> You can set the choices in the form __init__ to handle the issue:
>>
>>  class FooJBossForm(Form):
>> biz_service = MultipleChoiceField(
>> choices=[],
>> required=False,
>> label='Business Service',
>> widget=SelectMultiple(attrs={'class': 'form-control'}),
>> )
>>
>> def __init__(self, *args, **kwargs):
>> super(FooJBossForm, self).__init__(*args, **kwargs)
>> try:
>> self.fields['biz_service'].choices =
>> BizService.objects.filter(
>>biz_unit__bu_name='Foo',
>>  ).order_by('bs_name')\
>>
>> .values_list('bs_name', 'bs_name')\
>>   .distinct()
>> except ProgrammingError:
>> pass #OR Some placeholder choices
>>
>> Kirby
>>
>>
>>
>> On Thursday, February 15, 2018 at 9:56:56 AM UTC-5, jason...@gmail.com
>> wrote:
>>>
>>> Hello everyone,
>>>
>>> I have a form field that is pulling choices from the database:
>>>
>>> class FooJBossForm(Form):
>>> biz_service = MultipleChoiceField(
>>> choices=BizService.objects.filter(
>>> biz_unit__bu_name='Foo',
>>> ).order_by('bs_name').values_list('bs_name', 'bs_name').distinct
>>> (),
>>> required=False,
>>> label='Business Service',
>>> widget=SelectMultiple(attrs={'class': 'form-control'}),
>>> )
>>>
>>> ...
>>>
>>> This worked great until someone else on my team attempted to start with
>>> a fresh DB and was getting "relation does not exist" errors trying to do
>>> the initial import.
>>>
>>> Commenting out these "choices=" parameters in `forms.py` fixes the
>>> issue.  What's the right way to go about populating form field choices from
>>> the DB at access time?
>>>
>>> Thanks,
>>>
>>> j
>>>
>>>
>>>
>>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/4DbSczJGJF4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/ff2289b7-630b-4132-8d48-0ffc98715cdc%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFRq707a4YnfQ8vpdvq0AB3qYTuQmFaZQCXTKE-Z8AZyAscHZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to do "choices" from DB in form field without breaking migrations and such

2018-02-15 Thread jasonbnance
Thank you very much.  This worked perfectly.  Consequently it also fixed my 
issue of those select boxes not reflecting changes in the list until the 
web server was restarted since the data is now being pulled at 
instantiation instead of in the class definition.

j


On Thursday, February 15, 2018 at 9:54:24 AM UTC-6, C. Kirby wrote:
>
> You can set the choices in the form __init__ to handle the issue:
>
>  class FooJBossForm(Form):
> biz_service = MultipleChoiceField(
> choices=[],
> required=False,
> label='Business Service',
> widget=SelectMultiple(attrs={'class': 'form-control'}),
> )
>
> def __init__(self, *args, **kwargs):
> super(FooJBossForm, self).__init__(*args, **kwargs)
> try:
> self.fields['biz_service'].choices = BizService.objects.filter(
>biz_unit__bu_name='Foo',
>  ).order_by('bs_name')\
>   .values_list('bs_name', 
> 'bs_name')\
>   .distinct()
> except ProgrammingError:
> pass #OR Some placeholder choices
>
> Kirby
>
>
>
> On Thursday, February 15, 2018 at 9:56:56 AM UTC-5, jason...@gmail.com 
> wrote:
>>
>> Hello everyone,
>>
>> I have a form field that is pulling choices from the database:
>>
>> class FooJBossForm(Form):
>> biz_service = MultipleChoiceField(
>> choices=BizService.objects.filter(
>> biz_unit__bu_name='Foo',
>> ).order_by('bs_name').values_list('bs_name', 'bs_name').distinct
>> (),
>> required=False,
>> label='Business Service',
>> widget=SelectMultiple(attrs={'class': 'form-control'}),
>> )
>>
>> ...
>>
>> This worked great until someone else on my team attempted to start with a 
>> fresh DB and was getting "relation does not exist" errors trying to do the 
>> initial import.
>>
>> Commenting out these "choices=" parameters in `forms.py` fixes the 
>> issue.  What's the right way to go about populating form field choices from 
>> the DB at access time?
>>
>> Thanks,
>>
>> j
>>
>>
>>
>>

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ff2289b7-630b-4132-8d48-0ffc98715cdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to do "choices" from DB in form field without breaking migrations and such

2018-02-15 Thread C. Kirby
You can set the choices in the form __init__ to handle the issue:

 class FooJBossForm(Form):
biz_service = MultipleChoiceField(
choices=[],
required=False,
label='Business Service',
widget=SelectMultiple(attrs={'class': 'form-control'}),
)

def __init__(self, *args, **kwargs):
super(FooJBossForm, self).__init__(*args, **kwargs)
try:
self.fields['biz_service'].choices = BizService.objects.filter(
   biz_unit__bu_name='Foo',
 ).order_by('bs_name')\
  .values_list('bs_name', 
'bs_name')\
  .distinct()
except ProgrammingError:
pass #OR Some placeholder choices

Kirby



On Thursday, February 15, 2018 at 9:56:56 AM UTC-5, jason...@gmail.com 
wrote:
>
> Hello everyone,
>
> I have a form field that is pulling choices from the database:
>
> class FooJBossForm(Form):
> biz_service = MultipleChoiceField(
> choices=BizService.objects.filter(
> biz_unit__bu_name='Foo',
> ).order_by('bs_name').values_list('bs_name', 'bs_name').distinct
> (),
> required=False,
> label='Business Service',
> widget=SelectMultiple(attrs={'class': 'form-control'}),
> )
>
> ...
>
> This worked great until someone else on my team attempted to start with a 
> fresh DB and was getting "relation does not exist" errors trying to do the 
> initial import.
>
> Commenting out these "choices=" parameters in `forms.py` fixes the issue.  
> What's the right way to go about populating form field choices from the DB 
> at access time?
>
> Thanks,
>
> j
>
>
>
>

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d9a66087-72e5-4540-b717-bbb375f116da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to do "choices" from DB in form field without breaking migrations and such

2018-02-15 Thread jasonbnance
I should have included that the reason I'm using a `MultipleChoiceField` 
instead of a `ModelMultipleChoiceField` here is because I want the POSTed 
variable to be the business service name (string) not the primary key of 
the selected record.

j


On Thursday, February 15, 2018 at 8:56:56 AM UTC-6, jason...@gmail.com 
wrote:
>
> Hello everyone,
>
> I have a form field that is pulling choices from the database:
>
> class FooJBossForm(Form):
> biz_service = MultipleChoiceField(
> choices=BizService.objects.filter(
> biz_unit__bu_name='Foo',
> ).order_by('bs_name').values_list('bs_name', 'bs_name').distinct
> (),
> required=False,
> label='Business Service',
> widget=SelectMultiple(attrs={'class': 'form-control'}),
> )
>
> ...
>
> This worked great until someone else on my team attempted to start with a 
> fresh DB and was getting "relation does not exist" errors trying to do the 
> initial import.
>
> Commenting out these "choices=" parameters in `forms.py` fixes the issue.  
> What's the right way to go about populating form field choices from the DB 
> at access time?
>
> Thanks,
>
> j
>
>
>
>

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2fec400e-e20b-4030-acd5-9b1e2f9db6ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to do "choices" from DB in form field without breaking migrations and such

2018-02-15 Thread jasonbnance
Hello everyone,

I have a form field that is pulling choices from the database:

class FooJBossForm(Form):
biz_service = MultipleChoiceField(
choices=BizService.objects.filter(
biz_unit__bu_name='Foo',
).order_by('bs_name').values_list('bs_name', 'bs_name').distinct(),
required=False,
label='Business Service',
widget=SelectMultiple(attrs={'class': 'form-control'}),
)

...

This worked great until someone else on my team attempted to start with a 
fresh DB and was getting "relation does not exist" errors trying to do the 
initial import.

Commenting out these "choices=" parameters in `forms.py` fixes the issue.  
What's the right way to go about populating form field choices from the DB 
at access time?

Thanks,

j



-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a13f34ed-c8e9-4a92-829b-207e8eff4cf5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: chemistry character set

2018-02-15 Thread Mike Dewhirst

On 15/02/2018 10:19 PM, Hanne Moa wrote:

On 2018-02-06 12:51, Mike Dewhirst wrote:

Thank you. I think this is where we probably need to go. I asked the original 
question because I'm hoping the project will reach a tipping point and start to 
accumulate a growing number of multilingual users. We have our first 
multinational user but they only operate in the English speaking world so no 
pressure at the moment.

There can be no sort that satisfies every possible language at the same time. For instance, Norwegian sorts "ä" as "a" and 
"ö" as "o". Swedish sorts them after "å" as separate letters: åäö. Then there is Turkish where "i" sorts 
differently from "ı" (dotless i).


That is interesting! It says to me that longer term I need to think 
about special sort orders for different languages. A bit above my pay 
grade just now.


I've worked the greek letter prefixes by using a separate sort field 
only seen by the software. A simple replace('α', 'a') lets me adjust 
sort order for the moment. That may work with diacritics for some time. 
I'll be driven by actual requirements until I hit a brick wall and then 
I'll ask for PhD help :)


Thanks

Mike


I'm guessing chemistry names follow their own rules, you could see how hard it 
is to make your own os collation table and use that? Then everything running on 
the server would sort by the same rules.
HM



--
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bfd1633b-a651-fec9-6f2a-86efac8d2e8c%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Laying out a form like "fieldsets" and "TabularInline" on a non-"admin" page

2018-02-15 Thread Carl Brubaker
I've been trying to make a form that will get customer information:

First Name   Last NameMI
(etc)

and have been running into issues I can't seem to resolve without doing it 
the hard way. I was just wondering if there was an easier method?

Using generic views and edit views, the items in my model won't layout the 
way I want them to, so I manually made one.

1. When I manually made my html form, none of the labels for my input 
boxes show up. I though it would use a default "verbose_name", then I added 
a verbose_name, still didn't change.
- I added labels to my form, no change.
2. Even though MI is set to maxlength=1 in the model, every text box is 
the same size.

In the admin site you can use the "tabularinlines" and "fieldsets" to group 
and lay things out. Is there any method to achieving the same thing apart 
from the admin page? Or do I manually have to add labels to every "{{ }}" 
on my .html template? Thanks!


models.py

class Customer(models.Model):

first_name = models.CharField(max_length=20)
last_name = models.CharField(max_length=30)
middle_initial = models.CharField(max_length=1, null=True, blank=True)

forms.py

class CustomerForm(ModelForm):
class Meta:
model = Customer
fields = ('full_name', 'first_name', 'last_name', 'middle_initial')
labels = {
'first_name': _('First Name'),
'last_name': _('Last Name'),
'middle_initial': _('MI'),
   }

customer_form_view.html

{% extends "base_template.html" %}

{% block center %}

{% csrf_token %}
{{ form.first_name }} {{ form.last_name }} {{ form.middle_initial 
}}


{% endblock %}

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f6bddcb7-ec8e-40ca-8138-07e4317785ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: chemistry character set

2018-02-15 Thread Hanne Moa
On 2018-02-06 12:51, Mike Dewhirst wrote:
> Thank you. I think this is where we probably need to go. I asked the
> original question because I'm hoping the project will reach a tipping
> point and start to accumulate a growing number of multilingual users. We
> have our first multinational user but they only operate in the English
> speaking world so no pressure at the moment.

There can be no sort that satisfies every possible language at the same
time. For instance, Norwegian sorts "ä" as "a" and "ö" as "o". Swedish
sorts them after "å" as separate letters: åäö. Then there is Turkish
where "i" sorts differently from "ı" (dotless i).

I'm guessing chemistry names follow their own rules, you could see how
hard it is to make your own os collation table and use that? Then
everything running on the server would sort by the same rules.


HM

-- 
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d1bbe4f2-9036-d9d0-7217-38bba4d508aa%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Noob question: Is the User model compatible with subscription-style website?

2018-02-15 Thread Etienne Robillard



Le 2018-02-15 à 01:17, Tom Tanner a écrit :
I'm working on a Django-powered subscription website with a 
Django-powered CMS backend. Can the User model, or a derived class, be 
made to be compatible with this idea? In my case, I want to store a 
user's username, password, and subscription ID.

Yes.


--
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...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/da4f96f9-95cd-4b23-b4d2-842ef3649226%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
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...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f774e048-7889-d2fe-5623-e545ad4b6ac7%40yandex.com.
For more options, visit https://groups.google.com/d/optout.