Quantcast
Channel: Django talk
Viewing all 28280 articles
Browse latest View live

Re: Work from home opportunites

$
0
0
Connect me via skype: brijkishorrajput 

On Sat, 23 Feb 2019 at 8:25 PM, Abhinav tuteja <abhinavtuteja1997@gmail.com> wrote:
Hey i am also looking for some part time projects for extra income plz let me know.

On Sat, 23 Feb 2019 at 8:21 PM, Ben Indangasy <indangasy@gmail.com> wrote:
inbox me i have a project: Workflow Management System that i would like implemented in Python and Django - ben@beninda.com


On Feb 22, 2019, at 11:45 PM, Vaibhav Kumar Chaudhary <vaibhavkumar049@gmail.com> wrote:

Hi all, I am looking for work from home opportunities in Django. I have worked on a few personal projects and want to gain some industrial experience. So if anyone of you knows any opportunities. Please let me know. 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+unsubscribe@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/99e0b36d-bc06-4950-b1df-1e1f152f5ee8%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+unsubscribe@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/B3E2C705-9F3C-4D63-BA90-53CC2C1495F9%40gmail.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+unsubscribe@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/CAEN0qXWL37P2U0rRJY1h22L-RsnOVoSFt3bhSNWzVoMDnphNcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
Thanks & Regards

Brij Kishor Rajput

+91-999-086-7992 (M)
SkypeID: brijkishorrajput

--
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+unsubscribe@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/CAGaeKc51Wvny2cnj5WfEb%3DZY-_W319sG6odL07j-PCC%3DtwS7yQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Editing models in the view: Design advice needed

$
0
0
You'll need to use JavaScript and XHR to send data to the server without refreshing the page. What makes you think the POST would be janky and insecure?

On February 21, 2019 7:27:17 PM CST, Denver Sale <denverstuffsale@gmail.com> wrote:
Hello,

I'm somewhat new to Django/front end web development so I'm wondering what the best way to accomplish this would be. I have a "Rule" model which is made up of a few other models. On the view page, I'd like to list all the Rules with their associated attributes. In each Rule, I'd like the user to be able to edit it and adjust the attributes in the model which is associated with the Rule. Once they click save, I'd like to update the relevant models in the database and reflect that on the page, but I DO NOT want the page to refresh. I know I can do this using a JS library but it seems, from my research, that'd I'd have to create a rather janky and potentially insecure POST request. I could use ModelForms, but I'm unclear how I basically keep the entire page from refreshing rather than just the individual Rule being edited. Any advice on how to accomplish this is GREATLY appreciated. Thanks!

Attached is a mockup of what the UI view would look like. 

Re: Using progress bars while performing long computations and loading another page

$
0
0
Whenever I've used celery in the past, any logging in the celery task appears in the terminal running the celery worker.

On February 23, 2019 6:29:39 AM CST, Mohamed Maher <m.maher525@gmail.com> wrote:
Hello,

I have a scenario now where I send a GET request from a form in a web page to another page where I do some long processes before showing results. 

Now, I'd like to implement some progress bars that shows the level of completion of these processes and then get the output and show it on the results page.
I search alot about how to do that and I found some blogs about using Celery with a broker like RabbitMq or Redis to perform an asynchronus task along with the django project which loads an html page showing the progress bar and I tried to use this library 
https://github.com/czue/celery-progress
and I performed all the installation steps one by one however, the progress bar doesn't appear while I can't find any logs for the celery where I can figure out what is going wrong?

I'm asking about if there is an already implemented example with the same scenario which I can use or a better way explaining how to use celery and where can I find logs coming out of celery?


Thanks in advance

Cannot update file to a Django form

$
0
0
I can't seem to upload a file to a Django form.  The form POST is never valid.
Any ideas?

Here is my code...

def upload_file(request):
    if request.method == 'POST':
        form = tummytutoring.forms.UploadFileForm(request.POST, request.FILES)
        if form.is_valid():
            open("FTM_file.exe", "w").write(request.FILES['file'])
            return django.shortcuts.redirect("/thank_you")
    else:
        form = tummytutoring.forms.UploadFileForm()
    return django.shortcuts.render(request, 'upload.html', {'form': form})


Here is the template....

  <form action = "." method = "post">
    <div>{{form.file}}</div>

    <div><input type = "submit" value = "Send"/></div>

    {% csrf_token %}
  </form>

--
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+unsubscribe@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/fdd912f5-0aed-4e5c-bba7-7df5d334bf16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

aplicações python com interface web

$
0
0
boa noite.

fiz uma aplicação em python 3, executo ela pelo terminal no linux, mas queria criar uma interface web para poder executar essa aplicação em um servidor online.. a aplicação alem de ter conectividade com banco de dados ela gera e ler arquivos, alem de usar funções especificas de bibliotecas do python. 
é possível manipular essa minha aplicação pela web usando o Django? tipo.... criar um site para colocar essa minha aplicação online? 
o Django tem suporte para isso ou ele so cria sites normais ?

--
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+unsubscribe@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/c2298553-58f4-41b9-ad11-076f403e3a63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: How can I refresh admin_urls

$
0
0
Django Admin is customizable to an extent, but at a certain point those customizations can cost you more time than they save, and it makes more sense to build your business logic in a standard app/view. Without digging into your code, my spidey sense tells me your app is at that point - stop trying to do it in the admin and you'll have all the control you need or want.

./s

--
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+unsubscribe@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/43ab1f41-dedb-4302-93b9-37548d21fd8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Quick Favor?

$
0
0
Hey,

I just signed the petition "Donald J. Trump: PRESIDENT DONALD J. TRUMP: Publish all Files relating to the Assassination of Malcolm X" and wanted to see if you could help by adding your name.

Our goal is to reach 200 signatures and we need more support. You can read more and sign the petition here:

http://chng.it/k4wz5cqr7D

Thanks!
Demayne

--
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+unsubscribe@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/CAPBh%3DZrySfGYTdCh_VO%3DzbmgCDbOgoTuw2ct8-4AsQ36e5DZXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

how to recognize the voice using speech recognition in django

$
0
0
Hi all, 
Currently, I am doing my research work on speech recognition using Django. I have only one month to submit my research work.  Recognize the word is a part of my research work. I don't know how to write the code part in Django.

import speech_recognition as sr

# get audio from the microphone 
r = sr.Recognizer() 
with sr.Microphone() as source: 
 print("Speak:") 
 audio = r.listen(source)

try:
 print("You said " + r.recognize_google(audio))
except sr.UnknownValueError:
 print("Could not understand audio")
except sr.RequestError as e:
 print("Could not request results; {0}".format(e))


--
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+unsubscribe@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/CALEaTU7LkdoiwFa3Pcx253G%2BKm2T2UbamsO1aFB5UN%3Drq3VnGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Quick Favor?

$
0
0
What the hell is this ?!

On Sun, 24 Feb 2019, 02:49 , <collinsd73@gmail.com> wrote:
Hey,

I just signed the petition "Donald J. Trump: PRESIDENT DONALD J. TRUMP: Publish all Files relating to the Assassination of Malcolm X" and wanted to see if you could help by adding your name.

Our goal is to reach 200 signatures and we need more support. You can read more and sign the petition here:

http://chng.it/k4wz5cqr7D

Thanks!
Demayne

--
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+unsubscribe@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/CAPBh%3DZrySfGYTdCh_VO%3DzbmgCDbOgoTuw2ct8-4AsQ36e5DZXg%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+unsubscribe@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/CAHV4E-cN6zn2r63KHtWJ7F2qj6TEU0G8OZjxkUQ4w_LkL6VesQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

RE: how to recognize the voice using speech recognition in django

$
0
0

Hello all members of Django.

I, myself thinking of this question is great, want to know more about IVRS (Voice Interactive Response System) .

I would love to see some sample application to download and to learn from it.

Thank you everyone.

Sincerely,

 

Sent from Mail for Windows 10

 


From: django-users@googlegroups.com <django-users@googlegroups.com> on behalf of senthu nithy <senthunithy@gmail.com>
Sent: Saturday, February 23, 2019 10:04:19 PM
To: django-users@googlegroups.com
Subject: how to recognize the voice using speech recognition in django
 
Hi all, 
Currently, I am doing my research work on speech recognition using Django. I have only one month to submit my research work.  Recognize the word is a part of my research work. I don't know how to write the code part in Django.

import speech_recognition as sr

# get audio from the microphone 
r = sr.Recognizer() 
with sr.Microphone() as source: 
 print("Speak:") 
 audio = r.listen(source)

try:
 print("You said "+ r.recognize_google(audio))
except sr.UnknownValueError:
 print("Could not understand audio")
except sr.RequestError as e:
 print("Could not request results; {0}".format(e))


--
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+unsubscribe@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/CALEaTU7LkdoiwFa3Pcx253G%2BKm2T2UbamsO1aFB5UN%3Drq3VnGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Providing help on a website (basic CMS for on-site site documentation)

$
0
0
Hi Bernd

I don't know if you can find something here https://www.quora.com/Django-web-framework-What-is-the-point-of-using-flatpages, just maybe you read something you looking for.

Blessings
Christo

On Tuesday, February 19, 2019 at 7:26:57 AM UTC+2, Bernd Wechner wrote:
I'm at the point of wanting to write some help for a website, the standard helpfile sort of scenario ;-). If that means little to you, just a hierarchy of pages that document things and can be linked.

I wrote page one with the Django flatpages app:

https://docs.djangoproject.com/en/2.1/ref/contrib/flatpages/

But it's not real comfy in terms of editing and maintaining. So I looked on-line for solutions and of course nothing with "help" in the search terms is going anywhere fast (finds me a lot of help about Django ;-). so better keywordss needed but I have found a pile of maybe options and am suddenly bamboozled by what is vogue, current, maintained, has a lasting future etc.

https://github.com/klen/django_markdown

Untouched in 4 years with 22 open issues Hmm.

And this looks nice:

https://github.com/mjr27/django-flatpages-tinymce

but untouched in 7 years and 4 open issues.

Now untouched doesn't mean bad, could just be mature, stable and works perfectly, already fro 7 years. These are the things it's hard to gauge. But if I'm looking at TinyMCE how about:


on which it depends. NO bad, updated a month ago to make it work with Django 2.1 so seems alive! But my site is math heavy so I want equation ease so how about:

And this looks good:

https://www.codecogs.com/latex/integration/tinymce_v3/install.php

This looks maybe:

https://github.com/iCAPLyon1/tinymce-formula

This looks unconvincing:

https://github.com/foraker/tinymce_equation_editor

and do we want this:

https://github.com/Tivix/django-flatpages-nav

or this as well:

Or hang on why do this piecemeal why not use Wagtail from the word go:

http://docs.wagtail.io/en/v2.4/index.html

Or would wagtail introduce too much coordination trouble between its templates and my sites ... etc. etc. I'm full of questions and really just wondering, is there a canonical solution to a site documentation page hierarchy and managing it nicely?

Regards,

Bernd.


--
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+unsubscribe@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/4b0e1940-bd28-4b83-acb5-c98f972ee4c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: how to recognize the voice using speech recognition in django

$
0
0
I'm really unsure django is the right thing for this, because it is a WEB framework.  Meaning its for the construction and development of high quality web applications.  

You could definitely do a speech recognition addin to django, but if you don't need the browser interface or server deployment, I'd suggest you look at writing a python command line program instead  .In order to get this working with django, you would need to have a browser side interface to capture the audio and send it to django via ajax, and then have the server process the audio and return a response in which the browser renders.  That requires you to use two languages at minimum, and from what it sounds like, you are not familiar with django at all.  That's a substantial learning curve to tackle in a month, let aside designing, implementing and packaging a research project.

If I were you, I'd just make a command line program with python and have it execute directly on the machine being used.  No need for Django or web frameworks for this, and the smaller scope means you'll probably make the deadline without a great deal of additional stress.

--
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+unsubscribe@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/eb658ada-c678-4a7b-bebb-1c7b3b24579f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

DjangoCongress JP 2019 will be held in May. Waiting for your participation and talk!

$
0
0
Hello.

I'm Hiroki (@hirokiky), chairperson of DjangoCongress JP 2019.
https://djangocongress.jp/

Are you interested in Django and Japan?
This event will be held in Tokyo on 18th and 19th May.
Last year's DjangoCongress JP 2018 was also a success.

And we are looking for speakers.
The deadline of the CFP is March 5.
Please submit your talk!

At the event we provide English announcement and talks.
But it's small event, so you can get Financial Aids
(The ticket price will be free).

I'm looking forward seeing you at the venue!

--
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+unsubscribe@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/8de55bea-9f17-4878-8113-313280809f06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django Channels and multi-tenant will this be a world of hurt?

$
0
0
@N Muchai, 

I don't know if you've found a workaround to this, but here's mine if people are interested in the future. 

I just made a custom ASGI application that adds the tenant schema name (provided your URLs are in the form *.domain.com, where * represents the schema name) and whether the project is multitenant or not. I haven't thought much about whether the boolean for multitenancy identifier helps, so feel free to remove it in your implementation. I just stacked this application in my project's `routing.py` file. Here's the code I have at the moment: 

My Middleware:
class MTSchemaMiddleware:
    def __init__(self, inner):
        self.inner = inner

    def __call__(self, scope):
        if "headers" not in scope:
            raise ValueError(
                "MTSchemaMiddleware was passed a scope that did not have a headers key "
                + "(make sure it is only passed HTTP or WebSocket connections)"
            )

        for key, value in scope.get('headers', []):
            if key == b'host':
                schema_name = value.decode('ascii').split('.')[0]
                break
        else:
            raise ValueError(
                "The headers key in the scope is invalid. "
                + "(make sure it is passed valid HTTP or WebSocket connections)"
            )
        return self.inner(
            dict(scope, schema_name=schema_name, multitenant=True)
        )

My `routing.py`:

import MTSchemaMiddleware # from wherever your Middleware class resides
application = ProtocolTypeRouter({
'websocket': <your stack>(
            MTSchemaMiddleware(
URLRouter(
chat.routing.websocket_urlpatterns
)
)
            )
})

After you do this, you will be able to access the `schema_name` and `multitenant` variables inside your consumer's `scope` like this: `schema_name = scope['schema_name']` or `multitenant = scope[`multitenant`]`. 

Hope this helps someone! 

Best,
Ahmed


On Thursday, January 10, 2019 at 7:22:40 AM UTC-5, N Muchai wrote:
@Filbert,

Am in the same exact spot using Django Channels with django-tenants. Did you find a way to identify the tenant?

Thanks.

On Tuesday, November 28, 2017 at 4:22:10 AM UTC+3, Filbert wrote:
Sorry, yeah dig before I post :-|  Can create a class-based consumer and use the message->headers->host. I'll get chest deep before ask another question.

On Monday, November 27, 2017 at 6:04:48 PM UTC-5, Andrew Godwin wrote:
That would be correct (though please be aware Origin can be faked like host headers, so don't use it as the sole point of security).

Is it not available via the headers list in the connect message?

Andrew

On Mon, Nov 27, 2017 at 2:58 PM, Filbert <tim...@gmail.com> wrote:
Thanks again. One last question, in order to "multi-tenant-ify" Channels I think the challenge will be trickle the websocket "orgin" into the consumer from Daphne somehow as it seems there is no way to know in a consumer which tenant (unique domain) the message originated from. Without the domain you can't establish the Postgres schema, without the schema you have no tenant :-)

Please confirm this would be the approach or whether I am wrong-headed here.
Thanks.

On Sunday, November 26, 2017 at 9:58:58 AM UTC-5, Andrew Godwin wrote:
I've never used attach-daemon so I can't help you there I'm afraid. As long as it does sensible process-management things it's probably alright?

Andrew

On Sat, Nov 25, 2017 at 5:17 PM, Filbert <tim...@gmail.com> wrote:
Andrew,
Thanks for the response. Seeing that I am keeping uWSGI for the non-websocket paths, any heartache with me starting daphne and the consumers using uWSGI's attach-daemon? I do this with celery and it is a convenient way to have everything for the App managed as a unit via a single /etc/init (upstart) conf file.
Thanks. 

On Friday, November 24, 2017 at 7:10:29 PM UTC-5, Andrew Godwin wrote:
Your assumptions all seem correct. Also consider that the security model of WebSockets is... interesting, so securing a multi-tenant setup is going to require a bit more work than you would merely doing the same for HTTP requests.

There are other non-Channels options around if you want to look into them, but I suspect they'll all have similar architectural challenges.

Andrew

On Fri, Nov 24, 2017 at 3:09 PM, Filbert <tim...@gmail.com> wrote:
Running multi-tenant site using a fork of Django tenant schemas with tens of web servers and thousands of tenants....

Piloting a project to implement Channels for real-time notifications, etc.

I want to confirm these assumptions:

1. Channels really has no support for multi-tenant, I will have to roll my own.
2. Since uWSGI is serving us well and (at this point) I wouldn't trust Daphne to serve HTTP, I've got split paths in NGinx for uWSGI and ASGI.
3. We are running RabbitMQ, so we have to cluster it and implement channels using asgi_rabbitmq (Redis would just add yet another moving part)
4. Plan on significant additional resource requirements on the web server and serious scaling challenges.

Are their any other non-Channels options, or is it the really the only game in town?

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...@googlegroups.com.
To post to this group, send email to django...@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/aae2725b-d873-40fd-ae09-d1668ab9e727%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...@googlegroups.com.
To post to this group, send email to django...@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/d4906dc8-040b-4ee0-b11d-a7cc918b9e5d%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...@googlegroups.com.
To post to this group, send email to django...@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/4d7c94f1-81ad-4949-a987-35f45b188c2f%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+unsubscribe@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/52e898ef-e71c-49d0-8476-7bbd7c6f20ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: How can I refresh admin_urls

$
0
0

On Sunday, February 24, 2019 at 11:25:13 AM UTC+11, Scot Hacker wrote:
Django Admin is customizable to an extent, but at a certain point those customizations can cost you more time than they save, and it makes more sense to build your business logic in a standard app/view. Without digging into your code, my spidey sense tells me your app is at that point - stop trying to do it in the admin and you'll have all the control you need or want.

./s

Scot

I agree. How do I do that?

The entire system is in the Admin except for some trivial search and non-is_staff stuff. If I was to redo it without the Admin I would have to reinvent that entire wheel.

Specifically, how do I call an external view from within the admin? I only want to call that view if the model instance attributes demand it. That means it cannot be an optional/clickable link. It must be automatic.

Currently the admin url is (e.g.) http://localhost:8000/admin/substance/substance/1450/change/ while the substance is being edited. That url doesn't change while adding an ingredient. If the ingredient hasn't been paid for by *that* user the payment screen has to pop up. Currently it does this via modelAdmin.change_view() calling billing_payment_view()

That url doesn't change until after a successful payment when billing_payment_view() calls billing_success_view() directly. At that point the url becomes http://localhost:8000/admin/substance/substance/1450/change/payment (without a trailing slash). Thereafter valid admin urls fail to show any content..

If I make settings APPEND_SLASH False, it says 404.

Mike

--
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+unsubscribe@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/e019f0a5-04be-4106-a2fd-594c9f3d5b0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Invalid pk \"1\" - object does not exist.

$
0
0
Can you please explain how to define I'd in model.Cascade

On Feb 26, 2019 4:14 AM, "Phako Perez" <13.phakman@gmail.com> wrote:
I guess you need to define first the id in models.CASCADE, 

When you try to insert as per your table definition it looks for the key on that table

manager = models.ForeignKey('self', null=True, related_name='employee',on_delete=models.CASCADE)
Hope this can be helpful 

Happy coding!!!
Sent from my iPhone

On Feb 25, 2019, at 7:36 AM, optvisitor@gmail.com wrote:

getting error


{"manager":["Invalid pk \"1\" - object does not exist."]}


here is my model class

class Employee(models.Model):

MANAGER = 'MGR'
STANDARD = 'STD'


EMPLOYEE_TYPES = (

(MANAGER, 'manager'),
(STANDARD, 'employee')

)


role = models.CharField(max_length=25, choices=EMPLOYEE_TYPES)
name = models.CharField(max_length=100, null=True, blank=True)
employee_id = models.CharField(max_length=100, null=True, blank=True)
manager = models.ForeignKey('self', null=True, related_name='employee',on_delete=models.CASCADE)


and json data which i am using to save in table

{
"role":"MGR",
"name":"John",
"employee_id" :"IN",
"manager":1

}




--
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+unsubscribe@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/454e6708-d6f6-43ee-8542-85d92a69d1cd%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+unsubscribe@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/CF0263A3-5575-4CFF-A778-D2482DD8DB76%40gmail.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+unsubscribe@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/CAJB94UOiEXX_71DzSbhMhN%3DE9H3mwB_oCtPmDiQjDP-gaTPicg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Do we have solutions for this?

$
0
0
Dear All,

In Django based Job Portal (Open Source Initiative), I have few questions:

We need to find out if there are packages that can help in 

1) blocking domains (such as Yandex.ru) or specific IP address that spam the site
2) Any packages that will verify if PDF/Doc file is actually a resume
3) Any packages that will verify if Video pitch is in fact a video with a jobseeker pitch and not a marketing/promo spam video of some company.  

**Flag something that looks suspicious as a resume, or a promo video (having music, no voice etc)

How are others in django community dealing with such issues?
--
--

Roshan Shah/ Sr. IT Consultant
techieroshan@gmail.com / (519) 496-8860

This e-mail message may contain confidential or legally privileged information and is intended only for the use of the intended recipient(s). Any unauthorized disclosure, dissemination, distribution, copying or the taking of any action in reliance on the information herein is prohibited. E-mails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, or contain viruses. Anyone who communicates with me by e-mail is deemed to have accepted these risks.

--
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+unsubscribe@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/CALX19NhOoYhv1JsjYzjpyu7%2BXQ8VxvxjwCvA8S%3D-gker4aBdzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

test message

$
0
0
No need to answer this. I'm just seeing if googlegroups sends it me.
Haven't much from the list since gmail got itself listed in SORBS the
other day - and in particular I didn't get a message I posted in the
browser.

--
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+unsubscribe@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/f90e83f0-82c4-d460-5080-7a28d4bf1961%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

[Solved] Re: How can I refresh admin_urls

$
0
0
Thank you all for your attention. Kept me going.

The fix is to initialise the self.change_form_template to None *every*
time ModelAdmin.change_form() is called. If it is None the
ModelAdmin.render_change_form() method will dynamically create the model
instance change form. Otherwise it uses the form I give it. My problem
was it remembered that instead of doing its own thing when I had
finished with it.

I reckon it was designed to swap out the default form and completely
replace it forever. Thank heavens for open source.

Here is the only change to my code ...

def change_view(self, request, object_id, form_url='',
extra_context=None): """ self = SubstanceAdmin request = wsgi request
object object_id = substance form_url = no idea! extra_context = dict of
apps, models, admin_urls and permissions """ self.change_form_template =
None ############## this works ############# ingredients =
Substance_Ingredients.objects.filter(substance_id=object_id)
subscription = None for sm2mi in ingredients: payable, fee_type =
sm2mi.fee_payable() # eg., True, PAID_DATA if payable: subscription =
billing_subscribe(sm2mi, fee_type) if subscription: # we need to collect
money for the owner self.change_form_template = 'payment.html' context =
billing_collect_context( sm2mi, subscription, ) # get everything into
the payment_view context if not extra_context: extra_context = dict()
extra_context.update(self.admin_site.each_context(request))
extra_context.update(context) self.admin_site.admin_view( # call the
Stripe mechanism billing_payment_view( request, sm2mi, subscription,
context=extra_context, ) ) # only one sm2mi at a time break return
super(SubstanceAdmin, self).change_view( request, object_id, form_url,
extra_context )


 I reckon the Admin can do anything. It just takes some head scratching

:)

Mike

On 23/02/2019 6:58 pm, Mike Dewhirst wrote:
> (Resend with urls which I previously omitted)
>
> In a 'Substance' app I have a Stripe payment facility working from
> within the Admin. The problem is it spoils admin_urls so the user
> cannot get back to the Substance Admin. When the Stripe work is done,
> how do I re-initialise the admin urls?
>
> I want to display a success page with a link back to the substance
> page. I can provide exactly the correct url but all it shows is an
> admin page with no content. The correct url is
> /admin/substance/substance/<pk>/ and that works only if the Stripe
> mechanism has not been called since the dev server reloaded itself.
>
> I probably have an incorrect diagnosis here. The problem is most
> likely my misunderstanding of how to use the Admin properly. Any help
> will be very much appreciated.
>
> Thanks
>
> Mike
>
> The process uses ModelAdmin.change_view()[1] to call my
> billing_payment_view()[2] which uses PaymentForm[3] and
> payment.html[4] template to pass the necessary hidden vars.
>
> When the view executes (depending on whether payment is required) it
> pops up a (Stripe js) credit card collection form with a [Pay] button
> and that submits the detail to the Stripe API which in turn generates
> a token if successful or an error message and re-executes the
> billing_payment_view with request.POST including that detail plus all
> the hidden fields in the form. The view goes on to process the detail,
> generate a receipt, send an email to the payer and launch the
> billing_success_view()[5] and success.html[6] template.
>

--
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+unsubscribe@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/6f36e2b8-7ef0-c498-88c7-804d1e44a263%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

[Solved] Re: How can I refresh admin_urls

$
0
0
Thank you all for your attention. Kept me going. (another resend this time hopefully it will be laid out better)

The fix is to initialise the self.change_form_template to None *every* time ModelAdmin.change_form() is called. If it is None the ModelAdmin.render_change_form() method will dynamically create the model instance change form. Otherwise it uses the form I give it. My problem was it remembered that instead of doing its own thing when I had finished with it.

I reckon it was designed to swap out the default form and completely replace it forever. Thank heavens for open source.

Here is the only change to my code ...

    def change_view(self, request, object_id, form_url='', extra_context=None):
        """
        self = SubstanceAdmin
        request = wsgi request object
        object_id = substance
        form_url = no idea!
        extra_context = dict of apps, models, admin_urls and permissions
        """
        self.change_form_template = None  ############## this works #############
        ingredients = Substance_Ingredients.objects.filter(substance_id=object_id)
        subscription = None
        for sm2mi in ingredients:
            payable, fee_type = sm2mi.fee_payable()  # eg., True, PAID_DATA
            if payable:
                subscription = billing_subscribe(sm2mi, fee_type)
                if subscription:    # we need to collect money for the owner
                    self.change_form_template = 'payment.html'
                    context = billing_collect_context(
                        sm2mi,
                        subscription,
                    )
                    # get everything into the payment_view context
                    if not extra_context:
                        extra_context = dict()
                    extra_context.update(self.admin_site.each_context(request))
                    extra_context.update(context)
                    self.admin_site.admin_view(
                        # call the Stripe mechanism
                        billing_payment_view(
                            request,
                            sm2mi,
                            subscription,
                            context=extra_context,
                        )
                    )
                    # only one sm2mi at a time
                    break
        #if extra_context:
        #    logging.log(logging.DEBUG, '205 admin {0}'.format(extra_context))
        return super(SubstanceAdmin, self).change_view(
            request, object_id, form_url, extra_context
        )

 I reckon the Admin can do anything. It just takes some head scratching

:)

Mike

On 23/02/2019 6:58 pm, Mike Dewhirst wrote:
(Resend with urls which I previously omitted)

In a 'Substance' app I have a Stripe payment facility working from within the Admin. The problem is it spoils admin_urls so the user cannot get back to the Substance Admin. When the Stripe work is done, how do I re-initialise the admin urls?

I want to display a success page with a link back to the substance page. I can provide exactly the correct url but all it shows is an admin page with no content. The correct url is /admin/substance/substance/<pk>/ and that works only if the Stripe mechanism has not been called since the dev server reloaded itself.

I probably have an incorrect diagnosis here. The problem is most likely my misunderstanding of how to use the Admin properly. Any help will be very much appreciated.

Thanks

Mike

The process uses ModelAdmin.change_view()[1] to call my billing_payment_view()[2] which uses PaymentForm[3] and payment.html[4] template to pass the necessary hidden vars.

When the view executes (depending on whether payment is required) it pops up a (Stripe js) credit card collection form with a [Pay] button and that submits the detail to the Stripe API which in turn generates a token if successful or an error message and re-executes the billing_payment_view with request.POST including that detail plus all the hidden fields in the form. The view goes on to process the detail, generate a receipt, send an email to the payer and launch the billing_success_view()[5] and success.html[6] template.



Viewing all 28280 articles
Browse latest View live


Latest Images