Re: I made my first Django app, its goal is to generate a styleguide from your scss files
Il giorno gio 12 lug 2018 alle ore 16:44 Melvyn Sopacua ha scritto: > > First and foremost: awesome job. > Thank you! > On donderdag 12 juli 2018 14:38:16 CEST Carlo Ascani wrote: > > > More details, if interested: https://gitlab.com/2pxsolidblack/django-marple > > Your requirements.txt is a straight dump of pip freeze, including the `-e .`. > That's not maintainable. mmm that requirements.txt is needed only for the demo project, I suppose I could leave that out from the package...? > > I would worry about scaling: it's rather large in setup, so if for instance I > would load bootstrap 4's scss, would this be a gigantic long page and menu? > That's an amazing feedback, will work on that, thank you! > Keep at it! > -- > Melvyn Sopacua > > -- > You received this message because you are subscribed to a topic in the Google > Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/UJC8jOEQQ5o/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/2153578.lO0Rj1njIq%40fritzbook. > For more options, visit https://groups.google.com/d/optout. -- Carlo Ascani aka carloratm http://carlo.ratm.gitlab.io carloratm@freenode -- 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/CABVJJr-CprpPm610sprhgiB_0%2BwXQEzM-DybiL653BZbxs7svg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
I made my first Django app, its goal is to generate a styleguide from your scss files
Hi all, I just made my very first django reusable application. Its goal is to create a styleguide starting from your scss files. I would say that it is very frontend-developers-oriented (as I am). More details, if interested: https://gitlab.com/2pxsolidblack/django-marple Best, Carlo -- 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/04032c2e-610f-4258-9030-d49ee8e87196%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: What is the best route to take to build a general CMS using Django?
Il giorno gio 12 lug 2018 alle ore 04:53 afj afj ha scritto: > > I already saw some results for this search but what I found was another whole > framework to make even a simple CMS such as django-cms or wagtail > so what I want to know is is there any guidance to make just a simple CMS? django-cms and wagtail are not a `whole framework`, they are django applications which can be integrated in any Django project. > > On Thursday, July 12, 2018 at 5:39:20 AM UTC+3, mark wrote: >> >> The point of my response was to let the original author know that he/she >> should do some basic research first and then ask a more specific question. A >> general question like the one in the subject line is pretty much a wast of >> everyone's time, imo. >> >> Mark >> >> On Wed, Jul 11, 2018 at 6:24 PM, mottaz hejaze wrote: >>> >>> i think we can all use google mark . thanks for the good knowledge >>> >>> On Thu, 12 Jul 2018, 02:48 Mark Phillips, >>> wrote: >>>> >>>> https://www.google.com/search?q=What+is+the+best+route+to+take+to+build+a+general+CMS+using+Django%3F&oq=What+is+the+best+route+to+take+to+build+a+general+CMS+using+Django%3F&aqs=chrome..69i57j69i60.948j0j9&sourceid=chrome&ie=UTF-8 >>>> >>>> On Wed, Jul 11, 2018 at 5:21 PM, afj afj wrote: >>>>> >>>>> --- >>>>> >>>>> -- >>>>> 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/9b74041c-b869-49c7-a5a0-836bdcd9aad1%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/CAEqej2Piz7gnoKvgYTaP1Wjx9Y1Ud0-ecre-DMpGSD3SwBBs3A%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...@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/CAHV4E-ehvW9dxiGD3phywPByQ_JoN6MkvwAw13aGXjNH5Tagjg%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/489f8080-11ba-45c6-8295-41bc16c4857c%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Carlo Ascani aka carloratm http://carlo.ratm.gitlab.io carloratm@freenode -- 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/CABVJJr9MgZ0%2Bxp489xUyHgfNNZ68JiXZWn%3DwYxA6MHYu7Fn%2B%2Bw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Is there a way to find out if a Django site is built with Django CMS looking trough the source code?
Il giorno mer 4 lug 2018 alle ore 19:00 Brandon ha scritto: > > There's a site that a friend needed looking into, He's just the Marketing guy > so he wouldn't know for sure. > I get the feeling the site was created with Django and NOT Django CMS, is > there any way to tell without having access to the back-end? > Thank you in advance. Not sure but... try visit /admin and see if the login page looks like the Django one, or the django-cms one > > -- > 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/04c94ebb-93c9-4fce-9384-2ce4c4254cff%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Carlo Ascani aka carloratm http://carlo.ratm.gitlab.io carloratm@freenode -- 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/CABVJJr85cwa5cLiGPpvfGEwPKiFdqMbBSoBEepP3V4JpZo4aOQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
I wrote a very basic Django app - Looking for a mentor
Hi all, I wrote a simple Django 2.0 app I would like to distribute. I am a frontend developer, so my Python code could be a bit meh, that is why I am looking for someone you would like to mentor me and helo releasing a good quality codebase. The app does one simple thing: it crawls the sass files of your project looking for special comments, and generates a "living styleguide" for your website. If anyone is interested in helping me (mostly mentoring, I am a novice at Python), please write me in private or on IRC Freenode (carloratm) I have not released the code publicly only because I want to wait until the app reaches a minimum code quality standard. So, if you are interested in the topic, just let me know! To be clear: that is not a job position! :) Best, Carlo -- 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/67c45b2e-e459-4186-8d87-c742cb08b931%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Multisite strategy
Il giorno mer 23 mag 2018 alle ore 17:02 Daniel Germano Travieso ha scritto: > > Hello! > The Sites Framework is exactly what you need (and the proper > internationalization/localization for the languages). > Just set up your 3 sites the Django way (creating the propper settings.py for > each site) > Then you can run each site using `manage.py runserver --settings > .py` > > You can access each different site in development by going to localhost: > > As a suggestion, to avoid overhead in the creation of a site that is only > responsible for the choice of the site and language, I would assing one of > the two sites to be the default one, but the first action the user takes when > accessing the site is to choose location and language, but it is a personal > thing and your way can and will work fine! > > Hope it helps! Thank you! Is it possible to change the current site at runtime? > > []'s > Daniel Germano Travieso > Engenharia da Computação Turma: 013 > Unicamp > > On Tue, May 22, 2018 at 3:31 AM, Carlo Ascani wrote: >> >> Hi all, >> >> I'd like to implement something like this: >> >> One Django project to serve 3 sites: >> 1. `domain.com` which is the "master" site, containing just a landing page >> 2. `de.domain.com` which is the "German" site >> 3. `en.domain.com` which is the "UK" site >> >> `de` and `en` refers the location, not the language (e.g. >> `de.domain.com/en/` is the German site in English) >> >> If you go to `domain.com` you can choose the language and the country, and >> you are just redirected to the right place. >> >> Is `contrib.site` suitable for that scenario? >> I was thinking at 3 different sites. >> If so, how can I use them locally while in development? >> >> Any other suggestions? >> >> Best, >> Carlo >> >> >> -- >> 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/3b068855-78e7-4742-890d-1fc8a545b4f4%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/CABF8kZM%2BD-4Cou6s0bHJC15MeXLjeEaVrLBLdDTHd5%3DG1%3DupPA%40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. -- Carlo Ascani aka carloratm http://carlo.ratm.gitlab.io carloratm@freenode -- 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/CABVJJr8ONoKEWyYa-_43JMb%3DhnzRa_d6JzNfK29G58SkiwJQAw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Multisite strategy
Hi all, I'd like to implement something like this: One Django project to serve 3 sites: 1. `domain.com` which is the "master" site, containing just a landing page 2. `de.domain.com` which is the "German" site 3. `en.domain.com` which is the "UK" site `de` and `en` refers the location, not the language (e.g. `de.domain.com/en/` is the German site in English) If you go to `domain.com` you can choose the language and the country, and you are just redirected to the right place. Is `contrib.site` suitable for that scenario? I was thinking at 3 different sites. If so, how can I use them locally while in development? Any other suggestions? Best, Carlo -- 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/3b068855-78e7-4742-890d-1fc8a545b4f4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Question about m2m and forms
Il giorno sabato 18 febbraio 2017 11:02:25 UTC+1, Carlo Ascani ha scritto: > > > > Il giorno venerdì 17 febbraio 2017 20:09:15 UTC+1, Matthew Pava ha scritto: >> >> Hi Carlos, >> You probably want to create a new widget and override its >> label_from_instance method. >> >> class BModelMultipleChoiceField(forms.ModelMultipleChoiceField): >> def label_from_instance(self, obj): >> return "%s (%s)" % (obj, obj.count_a) >> >> >> And then you'll want to change your queryset to annotate the count so you >> can access it in the new field. >> class AFilterForm(forms.Form): >> to_b = BModelMultipleChoiceField( >> widget=forms.CheckboxSelectMultiple(), >> queryset = >> B.objects.all().annotate(count_a=Count('a_set'))) >> >> > Thank you! > That works really well. > The next step to this is would be to put the count in a separate property, so I can render it independently in the template (in a span, for example) is that possible ? Thank you in advance Carlo -- 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/71f50624-64aa-45b2-9ae8-7428d8e846b5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Implementing a basic search for my website
Thank you for all the answers! Given that I am implementing this for a demo purpose, I do not care about performances. I think I am going to do the 2 queries approach for the demo, then I would use a FTS engine in the future. Thanks a lot Carlo Il giorno martedì 21 febbraio 2017 02:09:46 UTC+1, Shawn Milochik ha scritto: > > If you want a pre-rolled solution, just use Django-haystack. It'll do > exactly what you want. > > If you want to create your own to avoid the dependency on additional > libraries and backend (you'll need something like Elasticsearch), that's > easy also. Let me know if you do. I have some sample code lying around and > will dig it up and document it a bit if you're interested in implementing > it. You'll still need to have to store your own indexed data in some kind > of backend, but you can use whatever you like. > > > -- 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/c1e0b295-4008-4cc3-8ca9-63bebe2395f5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Implementing a basic search for my website
Hi all, I am just trying to add a search funcionality to my frontend. I know it is a huge topic, so sorry my n00bih questions. I have a model A class A(models.Model): roles = models.ManyToManyField(B) location = models.ForeignKey(C) ... These 2 fields are the only fields I care about when searching, so I would say I need a very specific field based search funcionality. I wrote this view to handle it class ASearch(ListView): model = A template_name = 'search_result.html' def get_context_data(self, **kwargs): context = super(A, self).get_context_data(**kwargs) results = A.objects.all() query = self.request.GET.get('q') if query: query_list = query.split() results = results.filter( reduce(operator.or_, ( Q(roles__name__icontains=q) for q in query_list)) | reduce(operator.or_, ( Q(location__name__iexact=q) for q in query_list)) ) context.update({ 'results': results }) return context This is quite working. I mean, results are fine. But the problem is that I would like that searches who covers *all* conditions to come first. For example, let's say I search for 'MyRole MyLocation' the results I get are all the As for MyRole and all the As for MyLocation, mixed. I would like that As with MyRole AND MyLocation to show up first. I hope I was clear enough, but I doubt it. Thank you in advance -- 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/2c34b391-95d3-4ae9-acb1-81649833a725%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Question about m2m and forms
Il giorno venerdì 17 febbraio 2017 20:09:15 UTC+1, Matthew Pava ha scritto: > > Hi Carlos, > You probably want to create a new widget and override its > label_from_instance method. > > class BModelMultipleChoiceField(forms.ModelMultipleChoiceField): > def label_from_instance(self, obj): > return "%s (%s)" % (obj, obj.count_a) > > > And then you'll want to change your queryset to annotate the count so you > can access it in the new field. > class AFilterForm(forms.Form): > to_b = BModelMultipleChoiceField( > widget=forms.CheckboxSelectMultiple(), > queryset = > B.objects.all().annotate(count_a=Count('a_set'))) > > Thank you! That works really well. -- 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/c023ebf0-aeb7-4932-8e6a-b184a63c5b65%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Question about m2m and forms
Hi all, I have a model A with a m2m to B: -- class A(models.Model): to_b = models.ManyToManyField(B) class B(models.Model): name = models.CharField(max_length=100) -- In a view, I am listing A objects and I am building a form to use B as a filter. -- class AFilterForm(forms.Form): to_b = forms.ModelMultipleChoiceField( widget=forms.CheckboxSelectMultiple(), queryset = B.objects.all()) -- This is the view: -- class AListViewWithFilter(ListView): model = A def get_context_data(self, **kwargs): context = super(AListViewWithFilter, self).get_context_data(**kwargs) qs = A.objects.all() b_filter = None if self.request.GET: if 'to_b' in self.request.GET: b_filter = self.request.GET.getlist('to_b') res = res.filter(to_b__in=b_filter).distinct() context.update({ 'results': qs, 'form': AFilterForm(initial={ 'to_b': b_filter }) return context -- Everything is working fine. I would like to add a count of how many A objects are there for any of the to_b. So that the filter form would look like this: [ ] to_b_value_1 (34) [ ] to_b_value_2 (12) [ ] to_b_value_3 (3) ... Is that possible? Thank you in advance Best, Carlo -- Carlo Ascani aka carloratm Frontend Developer www.carlorat.me carloratm@freenode -- 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/CABVJJr8E47NCdbg%3DL0LwD%2BShMjFZ%3DD7zMsLgGCVxAj0Zjx4Mfw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: Trying to make a POST call to a Django view
2016-05-02 18:11 GMT+02:00 ludovic coues : > I would use the browser developer tools to look at what JQuery is > sending to django in the submit event. http://dpaste.com/2MQTNZP I do not see anything wrong there... Any ideas? Thank you > > 2016-05-02 18:01 GMT+02:00 carloratm : >> hello everyone, >> I am a frontend developer studying Django, so please forgive my noobish >> question... >> I am trying to make a simple ajax call working. >> >> I have a form in a template. I would like to use that form to save an object >> into the database (asynchronously). >> On form submit event: >> * I prevent regular action >> * I serialize form data in a JSON >> * I pass that object to a view using a jquery POST >> * The view receive the JSON data >> * The view use the request.POST data to save an object into the database. >> * The view returns a message. >> >> Is that flow straightforward, or am I completely missing the goal? >> >> Now some code and the error I got. >> >> The relevant part of template: >> >> http://dpaste.com/3Z7TRPM >> >> >> And this is the error I got: >> >> http://dpaste.com/3FYMGYG >> >> I noticed that in the view the request.POST is *empty*! >> That is wrong, I suppose. >> >> I am surely missing something. >> Any help is really appreciated. >> >> Thank you in advance, >> carlo >> >> -- >> 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/44f6da2a-c677-4485-99f2-eec20f8dfe0f%40googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. > > > > -- > > Cordialement, Coues Ludovic > +336 148 743 42 > > -- > You received this message because you are subscribed to a topic in the Google > Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/pRkBho_TZrQ/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAEuG%2BTb4q_-OwNX%2BMWbp2DQrRB0-gdSv5-rD-h31GYrSWHXwew%40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. -- Carlo Ascani | www.carlorat.me carloratm@freenode -- 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/CABVJJr-1NsiFcCU%2B-jsT9rVzDoZcesG18yt3Usz0LDXT3zj0YQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.