Re: Need help

2018-11-23 Thread رهام صادقی
Hi,
you can use request.user and check for this if exists.
If so you can redirect this user to another page or in your template do not
show any thing or pop up some errors.

‫<‪a...@codism.io‬‏> در تاریخ جمعه ۲۳ نوامبر ۲۰۱۸ ساعت ۲۰:۴۹ نوشت:‬

> If suppose a user is logged in to the system, and then the user goes to
> the url and go to register page using the url for ex. localhost/register.
> We don,t want this to happen. We don't want the user to go to the register
> page when he is already logged in. How can we resolve this issue? Please
> 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/93e2d87e-83e1-4656-8dab-153dfb41e5e9%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/CAJjGCEMu3oGMiwgo3MzmkFWNH1BzwiP69eH%3DEGa47mMtf9NMgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create event or trigger when user are created.

2018-11-23 Thread رهام صادقی
Hi,
You can use django signals with post_save decorators with your model as
receiver.
so every time a user created, your model will send a signal to your desired
function.

‫‪Elton Laice‬‏ <‪eltonlaice.map...@gmail.com‬‏> در تاریخ جمعه ۲۳ نوامبر
۲۰۱۸ ساعت ۲۰:۴۹ نوشت:‬

> hi guys.
>
> How to create event or trigger when user are created.
>
> thku
>
> --
> 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/CAGoRa9c9UqocvDSoaFi0K9kCnTDoS8ZMRKwDmFHvvQhLcga7uA%40mail.gmail.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/CAJjGCEPv4gkBAWhvgfEPWaPphR_sy1gzU79g%2Bg59ukTyG_RWsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice on choosing Django modules?

2018-11-23 Thread Jason
What I would advise you do is learn python first before getting into 
django.  reason being, you're requring yourself to learn a language *and* a 
framework simulataneously.  and the conventions in django don't always 
extrapolate and apply to python in general.  You can do it (I did, coming 
to python/django from Java/spring/gwt) but it did hinder my knowledge 
acquision significantly until I got over the hump

-- 
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/4878e6e1-734d-4298-93f9-fc1f0534ee31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Advice on choosing Django modules?

2018-11-23 Thread Dean Karres
Hi,

I have been teaching myself python at the same time I am starting with 
Django.  I have made a great deal of progress with both but am at a place 
where I could really use some advice.  I am trying to build a specialized 
"Membership" application for a US based non-profit.  The non-profit works 
with adults, children and families -- sometimes rather complex family 
structures.  A Membership Application for this entity needs to handle some 
peculiar situations.

I have looked at some of the Django e-commerce plugins but there are a lot 
of them and some seem to take a lot of configuration.  I get lost reading 
the setup/config docs while trying to see how a particular module can be 
configured for my needs.  This is where I need advice.

Because this org does not have money for hardware they will use Squareup 
for on-site dues, fees and product sales.  Squareup and/or Stripe for 
on-line purchases.

The on-line part of the application needs to:

@ allow "Adults", 18 years old or older, to sign-up/register (take profile
data).  Let's call this Adult with a login account an "Account Holder".
@ allow Account Holders to:
* purchase a personal "Adult" membership (one-time or recurring /
subscription) or signal that they will pay in person via with cash or
check.
* purchase one or more memberships for other related Adults or Youth
(under 18 years old).  The "other" membership purchases must take
"non-login" profile data.
* when creating additional memberships be aware of special billing
rates; for example: multiple memberships "belonging" to the Account
Holder are considered to be a "Family Membership".  No Family pays
more than a fixed amount per month.  Also, if multiple Youth 
memberships are created then there is special pricing: the first Youth
is at the regular Youth rate and each additional Youth is at a reduced
rate -- keeping in mind that maximum Family Membership rate.
* cancel Membership(s).
* modify Membership Profile data and payment methods for all Members
belonging to the Account Holder.
@ more than one Account Holder may have financial responsibility for a
"Family Membership".  This can get complex.  The non-profit does not
currently have any complex Family payment situations but in the past there
have been situations where a non-"member" parent/guardian will pay for
one or more members one month and one or more other parent/guardians
will pay for some sub-set of members.  Sometimes these non-members are
also non-Account-Holders.  All of the payments need to be tracked and 
applied to the correct member(s).
@ the "Profile Data" associated with each member needs to include the
obvious: name, birth-date, address, phone number(s) for contact, 
SMS-allowed number(s), emergency contact number(s), email address(es).  
Emergency contact information, especially for Youth, might need multiple 
contacts and an order of contact.
@ the non-profit is educational in nature.  The member information needs to 
carry information about test dates, pass/fail status, current level, class 
attendance dates.  This information should be viewable by the Account 
Holder but can oly be added/modified by an Teachers.
@ Teachers is a group that is made of select Account Holders who are 
Members.  Membership in the Teachers group is managed by Administrators.
@ Administrators is a group that is made of select Teachers.
@ report generation features should be available to Administrators and 
offer 
things like: 
* list of login accounts with no members with options to delete, revoke, 
lock the login accounts.
* list of members with filters for just about anything that can appear in 
the profile data.
* billing related reports: who paid, how much, how, when, in what time 
period, etc
@ Teachers need tools to, at least, take attendance.
@ Teachers and Administrators need the ability to allow new Account Holders 
to sign-up on-sitre; and, to allow Account Holders to add / modify 
account / member information.  Teachers may or may not need the ability to 
"Close" Account Holder accounts, that's still being debated.  They probably 
should be able to Pause accounts with comments that Administrators review.

That is not an exhaustive list but this is probably too long already.

In a nutshell, I need a membership, billing, student tracking app (or 
cooperating apps).  The advice I seek is: which existing Django based 
modules do what I want or come close?

Thanks

-- 
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/0fa5f920-db2f-494b-a398-6329588abf63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: New to this list question

2018-11-23 Thread Bob Gailer
On Nov 23, 2018 3:16 PM, "Dean Karres"  wrote:
>
> Hi,
>
> I just joined this list.  I am new to Django.  I have seen several of the
most recent postings.  I have a question i want to ask but am not sure if
this is the correct forum.  The question I want to ask is to get advice on
what Django module(s) I should use to either get me close to a final
application or get me all the way there.

The place to start is the Django tutorials.

I have looked at the list of Django modules but there are lots of them and
trying to compare/contrast while keeping my app goals in mind is proving
difficult.  I am hoping folks with more experience an help me filter things
a bit.  I would offer a 1000 foot view of what I want to accomplish but it
might be longish.  Is that Ok here?

Technically anything Jango related is okay here. Keep in mind the longer
your post the more likely it is to be not fully read. Could you give us a
10,000 foot overview?

Bob Gailer

-- 
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/CAP1rxO5D1%3Dmpi06_r9rC%2B9of8xocYSkV%3DM0gjEFrnqYFBNgDdw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


New to this list question

2018-11-23 Thread Dean Karres
Hi,

I just joined this list.  I am new to Django.  I have seen several of the 
most recent postings.  I have a question i want to ask but am not sure if 
this is the correct forum.  The question I want to ask is to get advice on 
what Django module(s) I should use to either get me close to a final 
application or get me all the way there.  I have looked at the list of 
Django modules but there are lots of them and trying to compare/contrast 
while keeping my app goals in mind is proving difficult.  I am hoping folks 
with more experience an help me filter things a bit.  I would offer a 1000 
foot view of what I want to accomplish but it might be longish.  Is that Ok 
here?

Dean

-- 
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/74b38627-770c-4b2c-870b-6e0ceb195d23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: need help on form view

2018-11-23 Thread Kasper Laudrup

Hi Pradeep,

On 23/11/2018 18.56, Pradeep Singh wrote:

how to use javascript in django...please tell me



You don't use javascript in Django. There are some Python modules for 
executing javascript code from your Python code, but why would you want 
to do that?


You're probably talking about writing javascript code that runs on the 
client, but that is not directly related to Django, so this is really 
not relevant here. Without any further information it's hard to know.


Start by reading this:

https://stackoverflow.com/help/how-to-ask

Then, when you've figured out how to formulate a useful question, start 
a new thread instead of highjacking a completely unrelated one like 
you've done here.


Kind regards,

Kasper Laudrup

--
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/2e43fe7c-0380-ca99-eb60-de86ada62090%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.


Need Help about django-filter and dataGrid

2018-11-23 Thread DELEAU Eric
Hello

I'm a new developper in django, i think my question are basic for expert 
but i want to know the best practice.

I made a view using the package "djando-filter"

*filter.py*

[image: filter.JPG]

*view.py*

[image: View.JPG]

*vue_microtrottroi.html*

[image: html.JPG]


*Questions :*

   - With the package django-filter, all data are sent to the html page. If 
   you have a lot of data on my model, it should be a problem ? Which other 
   solution could i use ?
   - With django-filter, could you manage the pagination and how ?
   - do you have any advice to add the ability to order the data in the 
   table after applying the search filter?
   

Thanks for your 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/34bb9c5e-41c7-45b8-9246-8814285ebeca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Strange intermittent UUID bug

2018-11-23 Thread Zach
You could try modifying to_python with something like this:

import logging


def to_python(self, value):
if value is not None and not isinstance(value, uuid.UUID):
try:
value = uuid.UUID(value)
except Exception as e:
logging.info('class: %s', e.__class__)
logging.info('module: %s', e.__module__)
logging.info('type(value): %s', type(value))
logging.info('value: %s', value)
raise exceptions.ValidationError(
self.error_messages['invalid'],
code='invalid',
params={'value': value},
)
return value


On Tuesday, November 20, 2018 at 9:47:25 AM UTC-8, Jerry Vinokurov wrote:
>
> Hi all,
>
> We have a project that uses UUIDs as a primary key for some objects. Our 
> project is deployed on AWS via Elastic Beanstalk. After the initial deploy, 
> everything works fine, but at some point, we encounter the following error, 
> deep within Django:
>
> ValidationError: ["'7c6eee47-53d0-48f6-a8b7-8aff82bc47c3' is not a valid 
> UUID."]
>
> Now, that certainly is a valid UUID; just pass it as a parameter to 
> uuid.UUID to verify that. So this is definitely odd. We use Sentry for 
> our error logging, and I dove into the stack trace, which I'll post a 
> picture of:
>
> [image: stack_trace.png]
>
>
> As can be seen in the stack trace, the following thing seems to happen:
>
> 1. Line 2315 is supposed to check for whether the value is already a UUID. 
> That check fails (the purple line above indicates that the execution path 
> has reached that line). Note that below, Sentry gives value as a UUID 
> object.
> 2. Line 2316 is therefore invoked, calling self.to_python(value)
>
> Here's the to_python function in its entirety (it can be found in 
> django/db/models/fields/__init__.py):
>
> 2322:def to_python(self, value):
> 2323:if value is not None and not isinstance(value, uuid.UUID):
> 2324:try:
> 2325:return uuid.UUID(value)
> 2326:except (AttributeError, ValueError):
> 2327:raise exceptions.ValidationError(
> 2328:self.error_messages['invalid'],
> 2329:code='invalid',
> 2330:params={'value': value},
> 2331:)
> 2332:return value
>
> 3. The isinstance check at 2323 also fails, and so uuid.UUID(value) is 
> invoked, which throws the ValidationError shown above, since the value 
> passed into the constructor is not a string.
>
> Now, the really, really weird thing about this problem is that *it goes 
> away when we redeploy the code*. We then seem to operate normally for 
> some time (as short as half a day, as long as several weeks) and then the 
> problem crops up again. And on top of all of this, we can't seem to at all 
> reproduce it locally; it only shows up in the production environment on AWS.
>
> This is bedeviling our entire team and I would love to know if anyone has 
> encountered a something like this or can provide any insight into just what 
> is happening here. It seems that it should not be possible and yet it's 
> happening.
>
>

-- 
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/6c7f234d-a415-41d8-adb9-58fd465168e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: need help on form view

2018-11-23 Thread Pradeep Singh
how to use javascript in django...please tell me

On Fri, 23 Nov 2018 at 18:51, Yavin Aalto Arba  wrote:

> I think the problematic part is " create_user = UserCreationForm(request.
> POST or None)"
>
> Most FBV for forms start with the "if request.method == 'POST" and then
> continue to fill the form. You can set the "None" after the if statement
> instead of before everything else.
>
> I am not sure that the or NONE syntax is working properly in your usage
> for this. Could be wrong. I suggest to try using the boilerplate way.
>
> On Fri, 23 Nov 2018 at 11:21, Tosin Ayoola  wrote:
>
>> Good day Guys,
>> working on a 3 step form but the issue now is that at the 2nd step the
>> form instead of redirecting the user to the final step, it instead
>> redirects back to the 1st step. below is my view, url code
>> #Views
>> def add_user(request):
>> create_user = UserCreationForm(request.POST or None)
>> if request.method == 'POST' and create_user.is_valid():
>> create_user.save()
>> return redirect(reverse('schoolprofile1'))
>>
>> return render( request, 'create_user_form.html',
>> {'create_user': create_user,
>> })
>>
>>
>>
>> def schoolprofile1(request):
>> school_info = SchoolsForm(request.POST or None )
>> if request.method == 'POST' and school_info.is_valid():
>> request.session['school_data'] = school_info.cleaned_data
>> return redirect(reverse('schoolprofile2'))
>>
>> return render(request, 'schoolprofile1.html',{
>> 'school_info': school_info,
>> })
>>
>>
>> def schoolprofile2(request):
>> school_info_two = SchoolDataForm(request.POST)
>> if request.method == 'POST' and school_data.is_valid():
>> complete_school_data_ = {
>> **request.session['school_data'],
>> **school_info_two.cleaned_data
>> }
>> Schools.object.create(**complete_school_data)
>>
>> return redirect('schoolDetail')
>>
>> return render(request, 'schoolprofile2.html',{
>> 'school_data':school_info_two,
>> })
>>
>> #URL
>>
>> urlpatterns = [
>> path('', views.index, name = 'index'),
>> path('schoolprofile/step-two', views.schoolprofile2, name='schoolprofile2
>> '),
>> path('schoolprofile/step-one', views.schoolprofile1, name = '
>> schoolprofile1'),
>> path('schoolprofile/add-user', views.add_user, name= 'add_user'),
>> path('schoolprofile', views.add_school, name='add_school'),
>> #path(r'ProfileYourSchool', add_School.as_view([profileForm,
>> SchoolsForm, schoolDataForm]), name = 'add_Schools'),
>> path(r'ContactUs', views.Contact, name = 'Contact'),
>> ]
>>
>>
>> thanks
>>
>> --
>> 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/CAHLKn73kTShkC7NsertLBbvrMnDp%3DJNQ0w2_iN41s-fVDiyRHw%40mail.gmail.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/CA%2B%2Be-ZVDX%2BdzyJ4fJ2L7sKvDsDaOWJYKjUfRGTsROtGyxcEBwQ%40mail.gmail.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/CANwgZcZR-VKJR58cXHBpCp8XRboBq6%2BbrTzi37rO4eaAH8NcBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to customize the formset of InlineModelAdmin?

2018-11-23 Thread Huan Lu
How to customize the formset of InlineModelAdmin.
Purpose: I want to customize the fields in InlineModelAdmin because I want 
to hide some fields.
My attempt:


class SKUInline(admin.TabularInline):
model = models.SKU
formset = modelformset_factory(models.SKU, fields=('values', 'price'))


@admin.register(models.Goods)
class GoodsAdmin(admin.ModelAdmin):
inlines = [
SKUInline,
]




Traceback (most recent call last):
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\core\handlers\exception.py", 
line 41, in inner
response = get_response(request)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\core\handlers\base.py", 
line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\core\handlers\base.py", 
line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\contrib\admin\options.py", 
line 552, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\utils\decorators.py", 
line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\views\decorators\cache.py", 
line 57, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\contrib\admin\sites.py", 
line 224, in inner
return view(request, *args, **kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\contrib\admin\options.py", 
line 1512, in change_view
return self.changeform_view(request, object_id, form_url, extra_context)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\utils\decorators.py", 
line 67, in _wrapper
return bound_func(*args, **kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\utils\decorators.py", 
line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\utils\decorators.py", 
line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\contrib\admin\options.py", 
line 1409, in changeform_view
return self._changeform_view(request, object_id, form_url, 
extra_context)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\contrib\admin\options.py", 
line 1467, in _changeform_view
formsets, inline_instances = self._create_formsets(request, obj, 
change=True)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\contrib\admin\options.py", 
line 1840, in _create_formsets
formsets.append(FormSet(**formset_params))
  File "E:\Workspace\pyenv\szrz\lib\site-packages\django\forms\models.py", 
line 583, in __init__
super(BaseModelFormSet, self).__init__(**defaults)
TypeError: __init__() got an unexpected keyword argument 'instance'
[23/Nov/2018 16:46:47] "GET /admin/goods/goods/1/change/ HTTP/1.1" 500 
124714



who can help me? thank you all!

-- 
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/7f454c4b-d101-4d68-bef4-b5444e444ece%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to create event or trigger when user are created.

2018-11-23 Thread Elton Laice
hi guys.

How to create event or trigger when user are created.

thku

-- 
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/CAGoRa9c9UqocvDSoaFi0K9kCnTDoS8ZMRKwDmFHvvQhLcga7uA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error when running python manage.py collectstatic

2018-11-23 Thread Henrik Sejersen
Hi Jason

Yes, I get the same error with Django 2.0.9 (the latest version) and Python 
3.7.1 - I am just about to make a bug report. Thanks!

-- 
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/ed409140-1c33-4fc7-94db-13176eb26157%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: URL path not working with Django ver 2.1.2

2018-11-23 Thread gordon nchy
in your url u tried to make use of regularexpression sign i.e ^$ so i
suggest u will have to make it a raw string in this way ( r'^$' ).


gnchy

On 23 Nov 2018 10:31, "Yavin Aalto Arba"  wrote:

> Path is not using regular expressions. Use empty quotes and it should
> work.
>
> On Fri, Nov 23, 2018, 5:28 AM Ben Hamlitsch 
>> This is the message I get when I run python manage.py runserver
>>
>> [image: Screen Shot 2018-11-22 at 7.18.58 PM.png]
>>
>>
>> This is my setup in Atom
>>
>>
>> [image: Screen Shot 2018-11-22 at 7.22.10 PM.png]
>>
>>
>> ANY help you can provide much appreciated.
>>
>> --
>> 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/11324094-eea3-488c-b8dd-9e0cc1d38262%
>> 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/CA%2B%2Be-ZUdOsZRJwJwikmbMN-EzTuY9H%
> 2BOf61XpWGXquLgpX_L%3Dw%40mail.gmail.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/CAEYkjC0Bw3woM0L3nTiPOfPeJ6Z3B7FyLpG6%2BNcbaB%2B3NaTR-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: Website is running in Django and also clients want to make theMobile APP.

2018-11-23 Thread gordon nchy
I face the same problem anyone to assist please!

Sent from Mail for Windows 10

From: Jani Tiainen
Sent: Friday, November 23, 2018 11:21
To: django-users@googlegroups.com
Subject: Re: Website is running in Django and also clients want to make 
theMobile APP.

Hi,

You can access Django site for example via RESTful API.

On Fri, Nov 23, 2018 at 9:52 AM Pravin Yadav  wrote:
Hello Everyone,

Good Morning,

I have created the website in Django + Python3. Website is running.
But I want to make the Mobile App. Can anyone guide me how will i work.



Thanks & Regards,
Pravin Kr Yadav
-- 
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/CAEr6%3DdyscxarOk4zNbERTaANf%2BAbnMHonFCYMau3dJH0nBMV4A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...
-- 
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/CAHn91odZE%2B_wWJBy8aviRgzYdKP1VTxvjkd05XTx%2Bon4VQGmnw%40mail.gmail.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/5bf7ec2a.1c69fb81.3bec3.dfe0%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


Need help

2018-11-23 Thread adil
If suppose a user is logged in to the system, and then the user goes to the 
url and go to register page using the url for ex. localhost/register. We 
don,t want this to happen. We don't want the user to go to the register 
page when he is already logged in. How can we resolve this issue? Please 
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/93e2d87e-83e1-4656-8dab-153dfb41e5e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to customize the formset of InlineModelAdmin.

2018-11-23 Thread Huan Lu
How to customize the formset of InlineModelAdmin.
Purpose: I want to customize the fields in InlineModelAdmin because I want 
to hide some fields.
My attempt:

class SKUInline(admin.TabularInline):
model = models.SKU
formset = modelformset_factory(models.SKU, fields=('values', 'price',))

@admin.register(models.Goods)
class GoodsAdmin(admin.ModelAdmin):
inlines = [
SKUInline,
]





Traceback (most recent call last):
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\core\handlers\exception.py", 
line 41, in inner
response = get_response(request)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\core\handlers\base.py", 
line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\core\handlers\base.py", 
line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\contrib\admin\options.py", 
line 552, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\utils\decorators.py", 
line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\views\decorators\cache.py", 
line 57, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\contrib\admin\sites.py", 
line 224, in inner
return view(request, *args, **kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\contrib\admin\options.py", 
line 1512, in change_view
return self.changeform_view(request, object_id, form_url, extra_context)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\utils\decorators.py", 
line 67, in _wrapper
return bound_func(*args, **kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\utils\decorators.py", 
line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\utils\decorators.py", 
line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\contrib\admin\options.py", 
line 1409, in changeform_view
return self._changeform_view(request, object_id, form_url, 
extra_context)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\contrib\admin\options.py", 
line 1467, in _changeform_view
formsets, inline_instances = self._create_formsets(request, obj, 
change=True)
  File 
"E:\Workspace\pyenv\szrz\lib\site-packages\django\contrib\admin\options.py", 
line 1840, in _create_formsets
formsets.append(FormSet(**formset_params))
  File "E:\Workspace\pyenv\szrz\lib\site-packages\django\forms\models.py", 
line 583, in __init__
super(BaseModelFormSet, self).__init__(**defaults)
TypeError: __init__() got an unexpected keyword argument 'instance'
[23/Nov/2018 16:46:47] "GET /admin/goods/goods/1/change/ HTTP/1.1" 500 
124714



-- 
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/72e724f6-616c-4e2b-98d1-0bde67c2772e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Website is running in Django and also clients want to make the Mobile APP.

2018-11-23 Thread Yavin Aalto Arba
There's a django plugin to quickly recognize if the page is loaded from a
mobile device and serve different templates accordingly:
*https://djangopackages.org/packages/p/django-mobile/
*

HOWEVER, I think a more simple and effective approach would be to work with
a one-stop-shop front end reactive design platform: Mobile-JQuery, React,
etc. which work well on all page resolutions.



On Fri, 23 Nov 2018 at 10:21, Jani Tiainen  wrote:

> Hi,
>
> You can access Django site for example via RESTful API.
>
> On Fri, Nov 23, 2018 at 9:52 AM Pravin Yadav  wrote:
>
>> Hello Everyone,
>>
>> Good Morning,
>>
>> I have created the website in Django + Python3. Website is running.
>> But I want to make the Mobile App. Can anyone guide me how will i work.
>>
>>
>>
>> Thanks & Regards,
>> Pravin Kr Yadav
>>
>> --
>> 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/CAEr6%3DdyscxarOk4zNbERTaANf%2BAbnMHonFCYMau3dJH0nBMV4A%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Jani Tiainen
>
> - Well planned is half done, and a half done has been sufficient before...
>
> --
> 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/CAHn91odZE%2B_wWJBy8aviRgzYdKP1VTxvjkd05XTx%2Bon4VQGmnw%40mail.gmail.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/CA%2B%2Be-ZXh7Zva8_q3JQGYN0C4krgatDzhHwH4qt%2BViH_LuACYrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Working with kronos

2018-11-23 Thread Jason
:-)  Good!  I know it can be intimidating, have been there a few times 
before.  But it gets easier the more you do it!

-- 
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/cc000c15-ad6d-4ca8-8f55-f3cbbb96dd7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: need help on form view

2018-11-23 Thread Yavin Aalto Arba
I think the problematic part is " create_user = UserCreationForm(request.
POST or None)"

Most FBV for forms start with the "if request.method == 'POST" and then
continue to fill the form. You can set the "None" after the if statement
instead of before everything else.

I am not sure that the or NONE syntax is working properly in your usage for
this. Could be wrong. I suggest to try using the boilerplate way.

On Fri, 23 Nov 2018 at 11:21, Tosin Ayoola  wrote:

> Good day Guys,
> working on a 3 step form but the issue now is that at the 2nd step the
> form instead of redirecting the user to the final step, it instead
> redirects back to the 1st step. below is my view, url code
> #Views
> def add_user(request):
> create_user = UserCreationForm(request.POST or None)
> if request.method == 'POST' and create_user.is_valid():
> create_user.save()
> return redirect(reverse('schoolprofile1'))
>
> return render( request, 'create_user_form.html',
> {'create_user': create_user,
> })
>
>
>
> def schoolprofile1(request):
> school_info = SchoolsForm(request.POST or None )
> if request.method == 'POST' and school_info.is_valid():
> request.session['school_data'] = school_info.cleaned_data
> return redirect(reverse('schoolprofile2'))
>
> return render(request, 'schoolprofile1.html',{
> 'school_info': school_info,
> })
>
>
> def schoolprofile2(request):
> school_info_two = SchoolDataForm(request.POST)
> if request.method == 'POST' and school_data.is_valid():
> complete_school_data_ = {
> **request.session['school_data'],
> **school_info_two.cleaned_data
> }
> Schools.object.create(**complete_school_data)
>
> return redirect('schoolDetail')
>
> return render(request, 'schoolprofile2.html',{
> 'school_data':school_info_two,
> })
>
> #URL
>
> urlpatterns = [
> path('', views.index, name = 'index'),
> path('schoolprofile/step-two', views.schoolprofile2, name='schoolprofile2'
> ),
> path('schoolprofile/step-one', views.schoolprofile1, name = '
> schoolprofile1'),
> path('schoolprofile/add-user', views.add_user, name= 'add_user'),
> path('schoolprofile', views.add_school, name='add_school'),
> #path(r'ProfileYourSchool', add_School.as_view([profileForm, SchoolsForm,
> schoolDataForm]), name = 'add_Schools'),
> path(r'ContactUs', views.Contact, name = 'Contact'),
> ]
>
>
> thanks
>
> --
> 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/CAHLKn73kTShkC7NsertLBbvrMnDp%3DJNQ0w2_iN41s-fVDiyRHw%40mail.gmail.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/CA%2B%2Be-ZVDX%2BdzyJ4fJ2L7sKvDsDaOWJYKjUfRGTsROtGyxcEBwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: URL path not working with Django ver 2.1.2

2018-11-23 Thread Ben Hamlitsch
Excellent thank you very much for your help.

Ben Hamlitsch

> On Nov 23, 2018, at 2:20 AM, Jani Tiainen  wrote:
> 
> Hi,
> 
> And if you want to still use old regular expressions you can use "re_path" 
> instead of "path".
> 
>> On Fri, Nov 23, 2018 at 5:28 AM Ben Hamlitsch  wrote:
>> This is the message I get when I run python manage.py runserver
>> 
>> 
>> 
>> 
>> 
>> This is my setup in Atom 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> ANY help you can provide much appreciated.
>> -- 
>> 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/11324094-eea3-488c-b8dd-9e0cc1d38262%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> Jani Tiainen
> 
> - Well planned is half done, and a half done has been sufficient before...
> -- 
> 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/CAHn91odfGEDdU4cYSQKp3ZV41WCQ_ZF0v8nTd7hf7LstcYNZag%40mail.gmail.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/36524A17-A455-4183-A833-FF9EA23EC968%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Website is running in Django and also clients want to make the Mobile APP.

2018-11-23 Thread Jani Tiainen
Hi,

You can access Django site for example via RESTful API.

On Fri, Nov 23, 2018 at 9:52 AM Pravin Yadav  wrote:

> Hello Everyone,
>
> Good Morning,
>
> I have created the website in Django + Python3. Website is running.
> But I want to make the Mobile App. Can anyone guide me how will i work.
>
>
>
> Thanks & Regards,
> Pravin Kr Yadav
>
> --
> 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/CAEr6%3DdyscxarOk4zNbERTaANf%2BAbnMHonFCYMau3dJH0nBMV4A%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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/CAHn91odZE%2B_wWJBy8aviRgzYdKP1VTxvjkd05XTx%2Bon4VQGmnw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: URL path not working with Django ver 2.1.2

2018-11-23 Thread Jani Tiainen
Hi,

And if you want to still use old regular expressions you can use "re_path"
instead of "path".

On Fri, Nov 23, 2018 at 5:28 AM Ben Hamlitsch  wrote:

> This is the message I get when I run python manage.py runserver
>
> [image: Screen Shot 2018-11-22 at 7.18.58 PM.png]
>
>
> This is my setup in Atom
>
>
> [image: Screen Shot 2018-11-22 at 7.22.10 PM.png]
>
>
> ANY help you can provide much appreciated.
>
> --
> 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/11324094-eea3-488c-b8dd-9e0cc1d38262%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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/CAHn91odfGEDdU4cYSQKp3ZV41WCQ_ZF0v8nTd7hf7LstcYNZag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.