Tuesday, November 30, 2021
return or not from super().method(*args, **kwargs)
I have a a question that I don't know where to send. Since it happened
programming in Django and I usually read this list I thought of sending
it here. I would like to ask if someone has strong feelings or if I
have missed some styling documentation.
This could be a generic Python styling question when re-implementing a
method of a base class. The example below is for models.Model.
Let's say that you had a model such as:
class Person(models.Model):
name = models.CharField(max_length=100)
def save(self, *args, **kwargs):
# some things...
# Question: do you do:
super().save(*args, **kwargs)
# or do you:
return super().save(*args, **kwargs)
Currently Model.save() returns None.
My thoughts:
-"return super().save(*args, **kwargs)":
-Good: if some day the base class changes and starts returning
something: the sub-class is forward-compatible :-)
-Good: less thinking when implementing the derived method: just do the
return always instead of having to check the base class method
-Bad: a reader might assume that Person.save() returns a value (instead of None)
-?: I haven't looked yet if I could add type hints for the return value of the the sub-class method saying "same as the base class".
-"super().save(*args, **kwargs)":
-Good: it's clear for the reader that nothing is returned
-Easy to do the type hints "-> None" if used in the project
Any thoughts? What would you prefer to see?
Currently I tend to go for the "super().save(*args, **kwargs)" (no
unnecessary return) as done in the Django documentation and to be
explicit in the present (it doesn't return anything)... but I have my
own doubts :-)
Part of this happened when I was reading some code and I thought that I
was in a "save()" for a form but I was in the model. For the form I need
to not forget the "return".
Thanks for any thoughts / comments :-)
Cheers,
--
Carles Pina i Estany
https://carles.pina.cat
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20211130221344.GA15295%40pina.cat.
Re: Django help needed URGENTLY!!!!
xsDNBGBJfrABDACxIFOMQIsP94wTkgf76JEHyTITmYnprsTeRmDet01G5etZ9ZHm
RmrqYVFzXu1aSBbaejm/ppbRrBB7YmFETbpnZepWJnuhridvjV37duRH3g/9ppiy
tNkhOOIYA/l8ppvyaRlrp/jPjAm27HVxi1Nu0syaWwTFKbUTtLKldIhuWvAXkgxp
xyBdB3jfmKoJ4rvTzZU+saKgaFExRmdd5Tpt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7tR6P+5PP6AQ==
=NePe
-----END PGP PUBLIC KEY BLOCK-----On 30/11/2021 02.25, Kay TV wrote:
> Hi everyone.
First of all, instead of a generic subject and screaming things like
urgent. Try to write a more descriptive subject. It will increase the
chances of someone being willing to help you.
> Can anyone please help. I have a Django project which i want to
> distribute as a Windows executable file. What do I do please?
>
You need to be more specific. It should be simple enough to create a
self-extracting archive, but I doubt that's what you mean or is it?
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7948b0f3-18a0-2cfe-b16c-a29ae091238e%40stacktrace.dk.
Monday, November 29, 2021
Issue in rendering of Inline forms on Django Admin site
2.2.4
- - - - - - -
in models.py
:
class MyModel(models.Model):
text = models.CharField(max_length=100)
class RelatedModel(models.Model):
parent = models.ForeignKey(MyModel, null=False, on_delete=models.CASCADE)
number = models.DecimalField(decimal_places=2, max_digits=10, null=False, blank=False)
admin.py
:class RelatedModelInlineTabular(admin.TabularInline):
model = RelatedModel
show_change_link = False
fields = ("number", )
class TestMyModelCreate(admin.ModelAdmin):
fields = ['text', ]
inlines = [RelatedModelInlineTabular]
admin.site.register(MyModel, TestMyModelCreate)
- Login to django admin website
- open the "add" view for
MyModel
(i.e. navigate to the list of Models and click on the "Add new" button
text
field. Below that, an Inline form is displayed with 3 empty rows for potential related instances of RelatedModel
Discount
is the related Model). Please note that I get the same result with both StackedInline and TabularInline.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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJzUX%3D68ejwz2Q0Lwvarw-hA%3DV5xsKfL%3D%2BHrsLzuHDkF2_ApmA%40mail.gmail.com.
Re: django@googlegroups.com
On Nov 29, 2021, at 1:37 AM, Bernard Mallala <bernard@autofyle.com> wrote:This is a very open ended comment but I will take a stab at it.To build a blood bank management solution, you will need to dabble in supply chain and leverage blockchain to uniquely track each transfusion through the supply chain, to the bank and delivery to the recipient vein.This is a big and expensive endeavor and I would recommend building such as solution only if you have a paying customer or strategic partner.For reference, IBM has such a solution for their clients, Canada's blood system is another good example, and various ministries of health also leverage similar systems. Not all countries have such and there is opportunity and need. Research "vein to vein" to learn more.On Sunday, November 28, 2021 at 9:20:49 AM UTC-7 asghedom...@gmail.com wrote:i want to develop blood bank management system in django what can you help me--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5632ef97-8761-49c3-bc01-61981a6cccacn%40googlegroups.com.
Re: Developing django apps in jupyter
VS code is also good and is smaller than Paycharm.
Hi everyoneI have built a few django apps, but on a very basic level and only for my own usage. Little helpers for self management. So far I just used vi(m).Now I tried out jupyter for the first time. Looks great and thanks to a few links from Google I could also load the django kernel in jupyter. Still I am not sure how to use juypter in order to develop django apps. Is this making sense to you? I either have one of those demonstration-/documentation-oriented notebooks or I have a plain py file as usual in django apps.My two questions are:1. Do you use juypter for django development?2. If not, which editor or free IDE do you use?Best regardsM--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/32085ce1-4bdc-4dfe-a031-9e4d6b15c9abn%40googlegroups.com.
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO-vjEQ1Z-NPsTT_nQkyrX272qOi81q%3Dkq3DmcO1GVTMhiUb4w%40mail.gmail.com.
Developing django apps in jupyter
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/32085ce1-4bdc-4dfe-a031-9e4d6b15c9abn%40googlegroups.com.
Sunday, November 28, 2021
Re: django@googlegroups.com
i want to develop blood bank management system in django what can you help me
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5632ef97-8761-49c3-bc01-61981a6cccacn%40googlegroups.com.
Saturday, November 27, 2021
Display api in particular format
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFx8_xf5d6r5cTv4i9OZyoZ2Y9_aJU9UgSNXs_ahKdhUVNQ1FQ%40mail.gmail.com.
Wednesday, November 24, 2021
Learn more about our updated Terms of Service
|
RE: Permissions Model Inefficiency Killing DB
select id from public.user where id in (select customuser_id from user_user_permissions);
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0d5aa4db-ccd7-482a-8530-1cc8d76bbcc0n%40googlegroups.com.
Permissions Model Inefficiency Killing DB
select id from public.user where id in (select customuser_id from user_user_permissions);
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0d5aa4db-ccd7-482a-8530-1cc8d76bbcc0n%40googlegroups.com.
def post in ListView
Is there anything dangerous about this?
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/aa7a1392-e388-4727-b412-bd1329daa6c4n%40googlegroups.com.
Tuesday, November 23, 2021
Question for Upload images issue
<span>Files</span>
<input type="file" multiple @change="handleFileUploads($event)" />
<ul v-if="files.length">
<li v-for="(name, i) in filesNames" :key="i">{{ name }}</li>
</ul>
</label>
<div>
<img v-for="image in images" :src="image" />
</div>
<br />
<button v-on:click.prevent="submitForm">Submit</button>
<script>
new Vue({
el: '#app',
data() {
return {
files: [],
images: [],
}
},
computed: {
filesNames() {
const fn = []
for (let i = 0; i < this.files.length; ++i) {
fn.push(this.files.item(i).name)
}
return fn
}
},
methods: {
handleFileUploads(event) {
this.files = event.target.files;
this.images = [...this.files].map(URL.createObjectURL);
},
submitFile() {
let formData = new FormData();
for (var i = 0; i < this.files.length; i++) {
let file = this.files[i];
formData.append('files[' + i + ']', file);
}
submitForm: function(){
const fna = []
for (let i = 0; i < this.files.length; ++i) {
fna.push(this.files.item(i).name)
}
console.log('fna');
console.log(fna);
axios({
method : "POST",
url: "{% url 'service-ad' %}",
headers: {'X-CSRFTOKEN': '{{ csrf_token }}',
'Content-Type': 'multipart/form-data'},
data : {
"images": fna,
},
}).then(response => {
console.log('SUCCESS!!');
}).catch(err => {
console.log('FAILURE!!');
});
}
})
</script>
if request.method == "POST":
data = json.loads(request.body)
images = data['images']
img_length = len(images)
if img_length == 1:
image_name = images[0]
image_name2 = ''
elif img_length == 2:
image_name = images[0]
image_name2 = images[1]
else:
image_name = ''
image_name2 = ''
savehotel = Hotel(
image=image_name,
image2=image_name2,
)
savehotel.save()
messages.success(request, """Your Ad is successfully posted.""")
return JsonResponse(safe=False)
return render(request, 'servicead.html')
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABscGkRXhvC6zALxCXvQN6-DmB%2BxedTSWO8KrPS2Nih0imZtXA%40mail.gmail.com.
Monday, November 22, 2021
Re: Multiple Templates in single list view
Its done bro model is configured already i didn't just posted the models.py fileOn Monday, 22 November 2021 at 21:18:12 UTC+5:30 ram.asf...@gmail.com wrote:will update asapOn Mon, Nov 22, 2021 at 1:22 PM David Nugent <dav...@uniquode.io> wrote:Well, there are several ways you can deal with that.Probably easiest is to override get_template() and switch the template based on whatever type of ticket you're managing or you can change the value of self.template_name based on the request.Or maybe you prefer a single template to deal with all cases with conditional blocks where appropriate.Regards,David--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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAE5VhgUCCnmkm%2BBe0EWLK4Nb%3DXUOHZAEYGax%2B2%2B-kCysYxdzHA%40mail.gmail.com.
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/211116cb-6012-4eb3-83f0-a11b79b7fecfn%40googlegroups.com.
Sunday, November 21, 2021
Re: Multiple Templates in single list view
we can go like
``````class Manager(...):def get_context_data(self, **kwargs):context = super() ....context["open_tickets"] = Ticket.objects.filter(status="OPEN")context["accepted_tickets"] = Ticket.objects.filter(status="ACCEPTED")context["completed_tickets"] = Ticket.objects.filter(status="COMPLETED")return contextOn Mon, 22 Nov 2021 at 12:19, Trippy Samurai <someshkan...@gmail.com> wrote:Hi Elena Thanks for the reply i have three different html pages to display open tickets closed tickets accepted tickets etc each of them have different ticket statuses i have them written in different views as above to display each type of ticket at different pages how can i combine all three in a single view so that i dont repeat my logic in views.Is there a way to acheive all the three views writing in a single view?--On Monday, 22 November 2021 at 10:04:14 UTC+5:30 elena wrote:Hi,The problem is it's unclear what your question is. Can you be clearer about what outcome you're trying to achieve?---On Mon, 22 Nov 2021 at 15:20, Trippy Samurai <someshkan...@gmail.com> wrote:Any one plzOn Sunday, 21 November 2021 at 15:09:39 UTC+5:30 Trippy Samurai wrote:Hello,I have different views for displaying different templates how do i write them into one single Listview so that i can take care of DRY--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d86e1449-a17e-4e93-9dd2-1fae9a7e91d7n%40googlegroups.com.
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c5eeae75-7c09-4f7e-928c-d03d5f10165an%40googlegroups.com.
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a000369b-b20f-4737-9bdc-f913f5af0a08n%40googlegroups.com.
Saturday, November 20, 2021
Re: TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
CommentForm inherits from both ModelForm and "forms". I don't know what "forms" is, but PEP-8 says all classes should be capitalized. If forms is a base class that has already defined Meta, then you need to have CommentForm's extend it. So change the line to class Meta(forms.Meta):--On Oct 28, 2021, at 8:18 PM, Sabbir Hasan Munna <sabbirhasan2999@gmail.com> wrote:
<Annotation 2021-10-29 081743.png>--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f7d8a010-0f68-437c-b3df-ec99a4460aafn%40googlegroups.com.
<Annotation 2021-10-29 081743.png>
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/E4AE72BA-48B0-4AD8-9D63-4AE9663F7C10%40gmail.com.
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO2Ykc4qRxn8%3DNaSCtdKE1GykCJLS0J%3DiNsGc33GC%2BQehM2-jQ%40mail.gmail.com.
choices = django background color
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ec931086-d720-49db-89ea-7de06f3622e0n%40googlegroups.com.
Thursday, November 18, 2021
Asynchronous test always failing
""" Asynchronously get a session for a system."""
@classonlymethod
def as_view(cls, **initkwargs):
view = super().as_view(**initkwargs)
view._is_coroutine = asyncio.coroutines._is_coroutine # pylint: disable=protected-access
return view
async def get(self, request, **kwargs):
""" Async get list of session between two dates """
end_period: str = request.GET['end']
start_period: str = request.GET['start']
gcloud_id: str = request.GET['gcloud']
offset: int = int(request.GET.get('offset', 10))
page: int = int(request.GET.get('page', 1))
system_uuid: str = kwargs['uuid']
cache_id: str = f"session_{system_uuid}_{start_period}_{end_period}"
if cache.get(cache_id):
log_data = cache.get(cache_id)
else:
session_service: SessionService = SessionService(system_uuid, gcloud_id, start_period, end_period)
log_data: List[Dict[str, Union[str, pd.Timestamp]]] = await session_service.get_session()
cache.set(cache_id, log_data, timeout=60 * 60)
nb_page: int = math.ceil((len(log_data) / offset))
pagination: Pagination = Pagination(offset, nb_page)
pagination.page = page
return JsonResponse({'logs': log_data[pagination.start_limit:pagination.end_limit], 'nb_page': nb_page,
'page': pagination.page},
safe=False)```
async def test_get_session_detail(self):
uuid: str = '2265d534-5a62-426a-bc44-e17ebddabfb3'
console_gcloud_id = 'console-7ccbe2e157d6'
start_period = '2021-05-06'
end_period = '2021-05-07'
response = await self.async_client.get(
f'/v1/sessions/{uuid}?end={end_period}&start={start_period}&gcloud={console_gcloud_id}',
)
print(response)
self.assertEqual(response.status_code, 200)```
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9a0754ee-e281-4363-a516-021983332acfn%40googlegroups.com.
Monday, November 15, 2021
Join Two fields during Import
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/25165bc9-3143-4d83-83d4-16002943caefn%40googlegroups.com.
Sunday, November 14, 2021
Re: Question regarding organizing models
On Sep 23, 2021, at 1:50 AM, Bhavin Shah <bhavinks.charlotte@gmail.com> wrote:Hello,Somewhat new to Django. I am trying to figure out the best way to define/organize models in Django app which have interdependent foreign keys. Simplified example below.
<Screenshot 2021-09-23 131449.png>The issue I am struggling with is the following
- The above example produces an error as User class is defined after Company. Reversing the order would cause the same issue with reference to Company class in User class. What is the best way to handle this scenario ? I tried to set the created_by_id value post the User class declaration, but then the django migrations do not recognize/set the foreign key correctly.
- I also tried to split the models into multiple files as the app is expected to have several models with such interdependent foreign keys. However in that scenario, the import are causing an error due to circular references.
Any suggestions/guidance on best way to handle such models would be very much appreciated. Thank you.Regards,Bhavin Shah
Wednesday, November 10, 2021
Custom User App
Hi Django people. I request your thoughts on a custom user app. It's called 'TougshireAuth', but my intent is that it be renamed and hacked each time it is added to a new project. Otherwise it's not really a custom user
I would appreciate feedback. I'm an amateur who is ready to accept honest criticism.
Thank you
https://github.com/tougshire/tougshire
--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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3ffb2e3f-c252-446c-a3ac-4377e7047190n%40googlegroups.com.
Tuesday, November 9, 2021
Django Admin Login
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/39bd9eb7-5002-4cc1-afd0-02eaa216da10n%40googlegroups.com.
Saturday, November 6, 2021
Re: Sanitize field from xss attacks in django models
Are you using the safe filter in your templates as otherwise that "attack" won't do anything but you are right that other XSS attack vectors can be used as per the example in the docs - https://docs.djangoproject.com/en/3.2/topics/security/#cross-site-scripting-xss-protection
If you are using safe then you could put a clean method on the form you are using to store the data in the first place to perform the validation/cleaning and if you wanted to go a step further and have places that update outside of forms then overload the save method of the class, put the custom validation in, then call super afterwards.On Saturday, 6 November 2021 at 12:44:05 UTC omark...@gmail.com wrote:hi alli want to sanitize 'content' field from XSS attacks in django modelsso i installed 'bleach' and used but script like "an <script>evil()</script> example" store as is (without sanitize script)Note: i need bleach via function in modelsAny idea ?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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6da70f02-17ab-4e3f-8595-c6d492208abdn%40googlegroups.com.
Re: Sanitize field from xss attacks in django models
If you are using safe then you could put a clean method on the form you are using to store the data in the first place to perform the validation/cleaning and if you wanted to go a step further and have places that update outside of forms then overload the save method of the class, put the custom validation in, then call super afterwards.
hi alli want to sanitize 'content' field from XSS attacks in django modelsso i installed 'bleach' and used but script like "an <script>evil()</script> example" store as is (without sanitize script)Note: i need bleach via function in modelsAny idea ?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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ba551e69-e4be-4f96-9aee-01c58c54c09en%40googlegroups.com.
Sanitize field from xss attacks in django models
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/65df3eee-f389-45cf-bb80-432fbcee40dbn%40googlegroups.com.
Wednesday, November 3, 2021
Re: Has anyone connected Django with AWS cognito in multi-tenant environment?
Heey Mike,
I'm new to Django, but not new to web development. I'm picking up Django/Python and I'm interested in setting up a SaaS multi-tenant application which leverages AWS's Cognito Identity/Infrastructure for scaling a SaaS Web application.In googling this, I found very little. There was a thread about a wrapper for Cognito called warrant, but from what I read, it's no longer supported and it didn't seem stable.Has anyone else gotten a multi-tenant Django app setup with AWS Cognito as your Identity/Authorization provider?
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/68579c8d-c796-40f1-b462-be7883b8d0d5n%40googlegroups.com.
Tuesday, November 2, 2021
Issue with django.forms.fields.FilePathField() and callable path
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b554a6eb-4978-428f-93b4-324a382557f0n%40googlegroups.com.