Re: How can I capture two slugs in one URL pattern?

2016-08-21 Thread ludovic coues
> objects = models.Manager() > > > def __str__(self): > return self.title > > > def get_absolute_url(self): > return reverse('link:link_detail', kwargs={"category": > self.category.slug, "slug": self.slug, >

Re: How can I capture two slugs in one URL pattern?

2016-08-21 Thread ludovic coues
:24 PM UTC+3, James Schneider wrote: >> >> >> >> On Sun, Aug 21, 2016 at 4:56 AM, ludovic coues wrote: >>> >>> You need to check somewhere that the category exist and that your item >>> belong to the category. >>> The get object method seems

Re: beginner . problem simple form.

2016-08-22 Thread ludovic coues
The second form tag is in an html comment. Everything inside won't be rendered. 2016-08-22 14:31 GMT+02:00 Vijay Khemlani : > Also, why do you have two form tags in your html? > > On Sun, Aug 21, 2016 at 10:40 AM, ludovic coues wrote: >> >> Do you have any message in

Re: Attribute error, with a very basic banking app

2016-08-25 Thread ludovic coues
Could you share the full stack trace you get when trying to run the server ? The attribute error should come with a ton of information like the file and the line where the error occur. 2016-08-25 16:57 GMT+02:00 Neil Hunt : > I've beem working on a simple banking app based on the Django tutorial.

Re: How to set up a form from an existing view

2016-08-26 Thread ludovic coues
First, your html is invalid. You can't put a whole form in a link. Nor a button. You can remove the element and put the shiny class on the input[type=submit] About your input[type=submit], I have some doubts about cross brother compatibility of what you are trying to achieve. It would be either t

Re: Django template iterating through two dictionaries/variables

2016-08-26 Thread ludovic coues
You could write a filter [1]. It would be used like {{ scores|from_player:person }} and look like that: def from_player (scores, player): return scores[player.Number] You might want to adjust to your actual code, check that you got the right arguments and that kind of things. [1] htt

Re: How to set up a form from an existing view

2016-08-27 Thread ludovic coues
e a very basic form question. What attribute gets posted > in the .POST? Is that value? In input? > > Secondly, the default value in the function, is that a type like text or > integer or is it just a place holder like "Chicago" or "2" > > Thanks > > >

Re: Not upoading image files in django

2016-08-27 Thread ludovic coues
You didn't provide your template file. Have you set enctype='multipart/form-data' on your form tag ? 2016-08-27 15:03 GMT+02:00 Mannu Gupta : > Image file is not getting uploaded using Django my all model,view and forms > files are attached with this link > > -- > You received this message because

Re: Part 5 of creating firat django app

2016-08-29 Thread ludovic coues
Do you mind to share the long traceback ? 2016-08-29 20:44 GMT+02:00 Matt Maloney : > I am at - test a view, and I just instantiated a client. I try doing the > command response = client.get(reverse('polls:index')) -- but with a long > traceback, the console ultimately says that it can't find > po

Re: ti possible CommaSeparatedIpField

2016-08-31 Thread ludovic coues
If you are asking if it is possible to create such field, the response is yes, you can create such field. Looking at the source of CommaSeparatedIntegerField, you can see it's a simple CharField with a validate_comma_separated_integer_list validator and a custom error message. You could also have

Re: How to create a database for my website in Django

2016-08-31 Thread ludovic coues
Hi jeff, I would suggest you looking up the documentation on creating a database [1] and the following section on how to connect to your freshly created database from django. When you get to creating your table, you might want to simply use django's tools. One of the key feature for developer on

Re: Getting Start Django

2016-08-31 Thread ludovic coues
+1 on using pip It will make your live easier 2016-08-31 15:15 GMT+02:00 Daniel França : > I rather recommend you using a virtualenv and install using pip instead > http://tutorial.djangogirls.org/en/django_installation/ > > On Wed, 31 Aug 2016 at 14:50 jsroyal wrote: >> >> >> sudo apt-get instal

Re: I am searching: How to make drop down list in django

2016-09-01 Thread ludovic coues
Do you mind to share a bit more of what you are trying to do ? There is a few way to get a dropdown list out of a django form class. https://docs.djangoproject.com/en/1.10/ref/models/fields/#django.db.models.Field.choices is one way to do it, for a specific use case. 2016-09-01 9:26 GMT+02:00 :

Re: Custom Template Tag

2016-09-01 Thread ludovic coues
I wouldn't do it this way. Personally, I would make the POST request in the view function, put the return value in the context. The template isn't a good place to have logic. It should only take data and format them. 2016-09-01 5:33 GMT+02:00 Al Johri : > Hi Django Users, > > I want to make a cust

Re: Pygame

2016-09-01 Thread ludovic coues
As long as the product of pygame is a python program and not a set of HTML and JS file, django won't help you. The other way can work. You can make HTTP request from pygame to django, to get a list of high score for exemple or a set of instruction in a turn based game, like a move in a chess play.

Re: Disadvantages of using model name rather than model class for FK field?

2016-09-01 Thread ludovic coues
Class might be easier to use for beginner and is explicit. There is an import, you know what you are dealing with and you get clear error when you do things wrong. If you have circular depencencies, using model name can be the only solution. If you have model A with a foreign key on model B and mo

Re: How to Let a User add a Video not a image as a post?

2016-09-02 Thread ludovic coues
First part of your problem is to get user submitted file and send the file back. Mike link might help you with that, I haven't checked. The second part is to show to the user an html video they can play. Last time I checkd, It was browser specific. Some only handle open codec like webm, other only

Re: Serving very large pdf files with django

2016-09-03 Thread ludovic coues
You have a few solution. You already excluded the user downloading the full document. You can display the document directly in your page, with solution like pdfjs, or you can extract the individual image from the document on your server and display directly the image. If you show the pdf, I fear y

Re: Blank field object just for headings in form object

2016-09-05 Thread ludovic coues
do you mind to share the model holding the questions created in admin ? 2016-09-04 19:33 GMT+02:00 Shane Fagan : > Hi, > > I asked this question on Stackoverflow but didn't get any answers so > hopefully someone can give me an answer here. The Stackoverflow is > http://stackoverflow.com/questions/

Re: How to split value where is comma ?

2016-09-07 Thread ludovic coues
That look a lot like a csv file. I strongly suggest you take a look at [1] and [2]. It should let you work with your data as if it's a list of dict. Pretty handy. If all you want is to add a newline after each comma, I suggest to use replace. >>> print("1,2,3".replace(",", ",\n")) 1, 2

Re: Custom form fields in admin site

2016-09-09 Thread ludovic coues
It's not easy to understand what you are trying to do and in which way it is failing. It would require us setting up a test project. I am assuming you want that the Admin display a form with a field for each of Mymodel field plus the myextra_field attribute and what you get is either only the name

Re: problem in converting PIL image object to django file object for saving in imagefield model type

2016-09-10 Thread ludovic coues
Using seek should do the trick. It's a function, taking an offset as its first value and a flag as second value indicating from where to apply the offset. It return the position after the seek operation. So io_object.seek(0, os.SEEK_END) will tell you the number of characters in io_object. That sho

Re: A little hitch in Installation!

2016-09-10 Thread ludovic coues
Are you using virtualenv ? 2016-09-10 9:10 GMT+02:00 Tushaar Gangarapu : > Hey, actually I had downloaded Django using pip. Now I tried using $ > django-admin startproject mysite. It shows "Cannot find installed version of > python-django or python3-django." > > A little help, please! > Thanks in

Re: Import css in Django

2016-09-11 Thread ludovic coues
Have you tried to add a few newlines to be sure about which line is the issue ? Also, in you email, there is a space between % and } in the load staticfiles tag 2016-09-11 7:29 GMT+02:00 Jonathan Cheng : > I use django1.10 > > i reference the official doc > https://docs.djangoproject.com/en/1.10/

Re: Import css in Django

2016-09-11 Thread ludovic coues
nal html with no css,is my path > setted correct? > > ludovic coues於 2016年9月11日星期日 UTC+8下午11時45分24秒寫道: >> >> Have you tried to add a few newlines to be sure about which line is the >> issue ? >> >> Also, in you email, there is a space between % and } in the loa

Re: Import css in Django

2016-09-11 Thread ludovic coues
ath you used as arguments for static. With a production configuration, you should use manage.py collectstatic which will grab all static file and copy them in a single directory. 2016-09-11 18:18 GMT+02:00 Jonathan Cheng : > > https://gist.github.com/cj10243/fb557903441d4a3e95190b854fbaabe1 >

Re: Import css in Django

2016-09-11 Thread ludovic coues
arch for static >>> file in each apps' static directory for the path you used as arguments >>> for static. >>> With a production configuration, you should use manage.py >>> collectstatic which will grab all static file and copy them in a >>> single

Re: create connection error

2016-09-12 Thread ludovic coues
Is there anything in the console ? 2016-09-12 3:46 GMT+02:00 : > def contact(request): > error = [] > if request.method == 'POST': > if not request.POST.get('subject', ''): > error.append("please enter a subject") > if not request.POST.get('message',''): > error.append("please enter a message") >

Re: Import css in Django

2016-09-12 Thread ludovic coues
the css worked > but i want to use the all files in assets > is there any other way to do it? > > ludovic coues於 2016年9月12日星期一 UTC+8上午1時32分42秒寫道: >> >> If you look at the html send by django, what is the href value ? >> >> 2016-09-11 19:15 GMT+02:00 Jonathan Che

Re: Can't create editable foreign key field in Django admin: going to give up on django

2016-09-12 Thread ludovic coues
Have you looked at https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#inlinemodeladmin-objects ? It's still early morning here so I haven't to it with your specific use case but the django tutorial use this feature to create a poll and its response in the same form. 2016-09-13 7:29 GMT+02:0

Re: how to display models in templates

2016-09-13 Thread ludovic coues
Can you try this in your template ? {{ bookmarks|pprint }} {% for bookmark in bookmaks %} {{ bookmark|pprint }} {% endfor %} Also, in your for loop, you use bookmarks.title, notice the s. 2016-09-13 9:33 GMT+02:00 Timothy Steele : > please i try my best but i can display my models in a templ

Re: how to display models in templates

2016-09-13 Thread ludovic coues
1600/hap.png> > please i like your help but it now return in the database, but in can see > the name of the bookmark but how can i do away with the QuerySet please > > On Tuesday, September 13, 2016 at 8:45:33 AM UTC+1, ludovic coues wrote: >> >> Can you try this in yo

Re: how to display models in templates

2016-09-13 Thread ludovic coues
Yeah, it's because of |pprint. It is a debug tools. It can help with a few issue like model not having a __str__ method (not your case). It also show how many item are in the queryset (one in your case). Now that you found the error, you can remove it 2016-09-13 10:30 GMT+02:00 Timothy Steele :

Re: Setting FK field in list view

2016-09-16 Thread ludovic coues
Have you tried something like author__name ? Assuming a model with an author foreign key. 2016-09-16 8:56 GMT+02:00 RompePC : > I would like to pass to the list display view a FK field of the admin form > (like the ones when adding a new row). But I don't see the way of doing it, > although I've s

Re: Registration form submission problem

2016-09-17 Thread ludovic coues
Personally, I would look at the generated HTML for the form, to see if anything is wrong. https://gist.github.com/gkrnours/6461781883e6add258d6a70ea1804b0f is how I have done a user registration view if you want to compare 2016-09-17 10:31 GMT+02:00 Timothy Steele : > below is also the views.py f

Re: Setting FK field in list view

2016-09-19 Thread ludovic coues
t know how to do get > it. > > El viernes, 16 de septiembre de 2016, 13:59:26 (UTC+2), ludovic coues > escribió: >> >> Have you tried something like author__name ? Assuming a model with an >> author foreign key. >> >> 2016-09-16 8:56 GMT+02:00 RompePC : >&

Re: Basic GenericForeignKey Question

2016-09-21 Thread ludovic coues
Unrelated, do you have any reason to not reuse the existing django permission system ? 2016-09-21 16:41 GMT+02:00 TheBeardedTemplar : > Hey all, > > I'm just getting started with GenericForeignKeys and I've run into a small > point of confusion. I'm implementing a very general permission system as

Re: Package a virtualenv to deploy across multiple systems?

2016-09-22 Thread ludovic coues
As long as you use similar hardware and the same OS version everywhere, a zip should work. You might get some issue if each machine have a different version of some lib on which python have dependencies 2016-09-22 3:25 GMT+02:00 'Abraham Varricatt' via Django users : > Hello, > > Do we have any st

Re: HTML Flexbox CSS

2016-09-25 Thread ludovic coues
Look like your css isn't loaded. Static file might be tricky to get right the first time 2016-09-25 15:09 GMT+02:00 Ed09 : > Trying to implement: > http://www.w3schools.com/css/tryit.asp?filename=trycss3_flexbox_website > within Django. > Works fine when all of the Flexbox section is within t

Re: Script App Developer

2016-09-26 Thread ludovic coues
That's exactly the subject of the django girls tutorial https://tutorial.djangogirls.org/ 2016-09-26 11:57 GMT+02:00 Civan Tunc : > Hi. Can you write a script or application to develop a blog site using > Django? > > -- > You received this message because you are subscribed to the Google Groups >

Re: Problem with Crispy-Forms

2016-09-26 Thread ludovic coues
I use something like that as a starting template, with bootstrap 4 {% load staticfiles %} {% block title %}WEBSITE{% endblock %} {% block head %} {% endblock %} WEBSITE ABOUT SEARCH {% block header %} WEBSITE{% endblock %} {% block body %} {% end

Re: Problem with Crispy-Forms

2016-09-26 Thread ludovic coues
Do you mind to share your full forms.py file ? The result in the teaser seems to depend on the FormHelper 2016-09-26 16:19 GMT+02:00 Jeff Silverman : > Thanks for the explanation. I think I get it. Does that, however, explain > why the Radio buttons don't display on separate lines? The "teaser"

Re: Problem with Crispy-Forms

2016-09-26 Thread ludovic coues
:) 2016-09-26 21:56 GMT+02:00 Jeff Silverman : > I was able to fumble my way through to the solution. What I think was > missing from the TEASER example was to add "CRISPY_TEMPLATE_PACK = > 'bootstrap3' > " to the settings.py file. Once this was added, the radio buttons properly > displayed unde

Re: [Help] Advanced tutorial: How to install my Python package with Virtualenv

2016-09-27 Thread ludovic coues
the command 'workon poll-tutorial' translate to "source poll-tutorial/bin/activate" on linux. That's why most user call it "activating a virtualenv. After your workon command, the terminal should display that you are in the virtualenv workon. You can try "where pip" which should give you the path

Re: [Help] Advanced tutorial: How to install my Python package with Virtualenv

2016-09-27 Thread ludovic coues
Once you are working on a virtual environment, simply using "pip install " will install in the virtualenv. No need for an option. 2016-09-27 21:12 GMT+02:00 ludovic coues : > the command 'workon poll-tutorial' translate to "source > poll-tutorial/bin/activate"

Re: Django not saving form in DB from frontend

2016-09-29 Thread ludovic coues
I would try to replace if form.is_valid(): new_form = form new_form.save(commit=True) with : if form.is_valid(): print("Form is valid") form.save(commit=True) else: print("Invalid form") Pretty sure you will get an invalid form, due to a miss

Re: How to setup django 1.9 with mongodb

2016-09-30 Thread ludovic coues
Django's ORM doesn't support mongodb or any non-relational database (read SQL only). So you set it up like any django, but you don't use the models 2016-09-30 11:37 GMT+02:00 danang geek : > hai Man How to setup django 1.9 with mongodb > > -- > You received this message because you are subscribed

Re: django form converter to PDF

2016-10-03 Thread ludovic coues
the xhtml2pdf doc point to weasyprint [1]. After a quick look at the doc [2], it look like a simple way to generate pdf from html file. If you already have a url on your django app rendering the quote, I would use weasyprint like that: from io import BytesIO from django.http.response impo

Re: An almost reusable app, how to make it reusable?

2016-10-03 Thread ludovic coues
Provide a default value or raise a ImproperlyConfigured error if the key is missing. Document the need to set the key. That should be enough to call your app "reusable". 2016-10-03 21:06 GMT+02:00 Victor Porton : > I've created an app which is "almost" reusable: it depends on a variable in > /set

Re: Python Django on Hostica server

2016-10-05 Thread ludovic coues
>From what I have read of hostica, they only offer to host website written in PHP. 2016-10-05 15:21 GMT+02:00 Andris Diržininkas : > Hi there > > Actually I have very basic knowlage about web programming but I'm working > with a web programmer who does it on Python Django. I asked him to put the >

Re: Django FormWizard Keep Values Between Steps

2016-10-07 Thread ludovic coues
I would use only one form and only display a few field on each step of the wizard 2016-10-07 5:39 GMT+02:00 Nelson Diaz : > # forms.py > class ContactForm1(forms.Form): > subject = forms.CharField(max_length=100) > > class ContactForm2(forms.Form): > sender = forms.CharField(required=False

Re: model form does not work

2016-10-10 Thread ludovic coues
Most of the time, it help to provide the full stack trace that come with the error. The one in the console where you started django should be easier to copy and paste. In your case, it look like a typo. In forms.py, it should be `class Meta` and you wrote `class meta`. An alternative is to use c

Re: template or javascript

2016-10-10 Thread ludovic coues
Personally, I pass a dict named current in the context. For the home page, the dict is {'home': 'active'} and for about, it's {'about': 'active'}. Then the link to the home page is , the link to about is , etc... It might not be the best way but it's pretty straightforward and that's what I use wh

Re: Unit testing in django for django template

2016-10-12 Thread ludovic coues
Personally, I use lxml to check the presence of HTML element based on xpath. Here is an exemple of how I do it: from django.core.urlresolvers import reverse from django.test import TestCase from lxml import etree class UserUrlTestCase(TestCase): """ Test for the user app "

Re: Selenium Functional Tests against Heroku-hosted Django Site

2016-10-14 Thread ludovic coues
Have you tried to do it yet ? Have you found any specific problem you need help solving ? 2016-10-14 3:52 GMT+02:00 A Wall : > Hello, > > I'm looking to run functional tests using Django 1.10.2 and Selenium 3.0.0 > against a staging Django site hosted on Heroku. To be clear, I want to do > someth

Re: Tutorial part 4 help: the raidio buttons to make a choice on the polls question won't show.

2016-10-22 Thread ludovic coues
I would try to add that right before the loop: {{ question|pprint }} {{ question.choice_set.all|pprint }} The result should be something like that the pprint filter is for debugging, you should remove once your issue is fixed. It will make obvious some error like question.choi

Re: Am I missing a design pattern? My views code somehow isn't as elegant as it should be...

2016-10-22 Thread ludovic coues
Class Based View really shine in form handling. You can find the documentation at [1]. All the boilerplate code will be 3 assignment like template_name = 'wizard/questionnaire.html' while the logic will go into form_valid function. I would also add a comment for the Matcher object and why the m va

Re: Am I missing a design pattern? My views code somehow isn't as elegant as it should be...

2016-10-23 Thread ludovic coues
Python doesn't have special structure to separate internal and interface. There is a convention of prefixing the internal with an underscore. That's all. So having IPInfo.request being part of your interface is totally fine. Or you could keep things as they are. Or rename IPInfo.request to IPInfo.

Re: Method must be called with Class instance

2016-10-24 Thread ludovic coues
It's a python error. First argument of method on an object is always the object itself, named self by convention. For exemple, class Greet: def hello(self, name): print("Hello %s!" % name) Python will take care of passing this argument when you call the method. 2016-10-24

Re: Using django pagination or slicing

2016-10-31 Thread ludovic coues
I would use 1 + 2 from your list. 3 might work on 1000 record, depending on how much data there is per record. But if you grow to more than 10,000 record, the page loading can take minutes. I have experienced that issue with two different project. Django pagination by itself won't give you the in

Re: Form Saving Related Issues

2016-11-01 Thread ludovic coues
You need some kind of ajax. Once the user have entered their email, send a request to your django app with only that email. Django check if the email exist and send a reply with yes or no. 2016-11-01 3:30 GMT+01:00 pradam programming : > Thank you sir for the reply.. > But I am using HTML forms th

Re: What is the use of parent_template filter in Django templates

2016-11-01 Thread ludovic coues
Is there any variable called parent_template in the context ? 2016-11-01 15:26 GMT+01:00 Prateek : > I am reading Django Unleashed in which the author uses the following code to > extends the template > > {% extends parent_template|default:"organizer/base_organizer.html" %} > > > What does parent_

Re: django

2016-11-02 Thread ludovic coues
Hello, You can try the official django documentation: https://docs.djangoproject.com/en/1.10/intro/ There is other tutorial which cover more feature and might be easier to follow. I learned form with this one for exemple: https://tutorial.djangogirls.org/ 2016-11-02 16:28 GMT+01:00 : > Hello fri

Re: Need help to catch "cart_id" based on session.

2016-11-06 Thread ludovic coues
I would try request.session.get('cart_id', None) instead of request.session['card_id']. Both act the same if the key exist in the dict. When the key is missing, the first return the second value (None in this case) while the second raise a Key Error exception. 2016-11-05 13:10 GMT+01:00 Shazia Nu

Re: How to create a django model for a resume/CV app

2016-11-06 Thread ludovic coues
If you are using the default django admin, you can use inline model admins [1]. The django's tutorial covert this point with polls' questions having many possible choice in part 7 [2] [1] https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#inlinemodeladmin-objects [2] https://docs.djangopr

Re: Django (Admin Page)

2016-11-07 Thread ludovic coues
Hello, If you are talking about your model, you need to create a ModelAdmin class [1] for your models. There is an exemple of how to do so in the django tutorial [2]. [1] https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#modeladmin-objects [2] https://docs.djangoproject.com/en/1.10/intro

Re: One template for multiple views

2016-11-07 Thread ludovic coues
You can also have a base template, with a block for the title then extends that base template with the extends tags. 2016-11-07 20:25 GMT+01:00 Moreplavec : > Yes, i know i can pass data (variables) from view to template. But my > question is, if i have report, for example with headline "This mont

Re: Best practices for directories in which to store stuff in production

2016-11-08 Thread ludovic coues
If I had to use such scheme, I would put the django application in a package for the target system. Like a .deb file for exemple. If your primary way of deploying is a git push from test/QA to production, split directory will cause plenty of headaches. Also, with an installation like this, I would

Re: Setting up jQuery in debian with virtualenv

2016-11-09 Thread ludovic coues
Hello, Django provide tools to deals with static files like javascript or css. The documentation is at [1]. [1] https://docs.djangoproject.com/en/1.10/howto/static-files/ 2016-11-09 21:26 GMT+01:00 Gary Roach : > Hi all, > > I am just starting to use jQuery and Ajax in my project and am having >

Re: Django and asynchronous tasks

2016-11-10 Thread ludovic coues
Websocket provide a way for server to send information to the client without waiting for input from the client. Django channels [1] is a project to bring native support of websocket to django. There are alternatives which might involve a bit more of work [1] https://channels.readthedocs.io/en/sta

Re: localStorage to save answer to form until it is sent to server

2016-11-10 Thread ludovic coues
localStorage is a client-side technology. You interact with that using javascript. Django only deal with the server-side. If the text area you are talking about is in the django's admin, you should take a look at how third party providing rich editing textarea are doing. 2016-11-10 16:41 GMT+01:

Re: Setting up jQuery in debian with virtualenv

2016-11-10 Thread ludovic coues
> >> > >> On 2016-11-09 23:54, Gary Roach wrote: > >>> > >>> Ludovic > >>> > >>> Thank you for the reply but I know how to use static files. The > problem is > >>> that I already have a jquery file under version control inside

Re: how to add additional parameters to the queryset in forms.py

2016-11-12 Thread ludovic coues
You already have a parameter named year so you should use self.year = year instead of self.year = kwargs.pop('year'). Same for month and day. 2016-11-12 22:39 GMT+01:00 احسان خراسانی : > HI > i want to add additional parameters to the queryset in forms > > class Reserve(forms.ModelForm): > > f

Re: Drawing with Django

2016-11-13 Thread ludovic coues
It's barely related to django. If all you want is to make annotation, it's fairly easy and you don't really need canvas and it's mainly javascript, which is independent from django. First, display your image. Second, get where your user want their annotation. I would do that by listening to click

Re: Loading the content of an iframe

2016-11-21 Thread ludovic coues
This is an HTML problem, not a django one. You can try to set a property target="iframe1" on your link. Like that: welcome 2016-11-19 23:01 GMT+01:00 Gary Roach : > Hi all, > > I am really stumbling around with my project at present. I am relatively new > to both Python and Django and have starte

Re: How to create a django model for a resume/CV app

2016-11-21 Thread ludovic coues
ngth=100) >> company = models.CharField(max_length=100) >> start_date = models.DateField(blank=True, null=True) >> end_date = models.DateField(blank=True, null=True) > > > > On Sunday, 6 November 2016 22:05:16 UTC+1, ludovic coues wrote: >> >> If

Re: Upload Images from Remote Server

2016-11-22 Thread ludovic coues
The actual full stacktrace and at least the relevant function in your code would be nice. 2016-11-21 14:09 GMT+01:00 pradam programming : > hi Guys, > 1.I have Created an API which store images into database just giving image > path but issue is when i remotely upload image using API i will get th

Re: Upload Images from Remote Server

2016-11-22 Thread ludovic coues
ore getting the error. That help a lot when dealing with error. 2016-11-22 12:15 GMT+01:00 pradam programming : > Hi Ludovic, > What is Full stacktrace ..? i tried very solution but i can't able to store > image without a form in rest framework..? > > On Tue, Nov 22, 2016 at 2:56

Re: where does logging configuration go?

2016-11-26 Thread ludovic coues
the settings.py file of your project 2016-11-25 23:15 GMT+01:00 bob gailer : > https://docs.djangoproject.com/en/1.9/topics/logging/ > > shows some logging configurations, but does not tell me where to put them. > > Where would you suggest? > > -- > You received this message because you are subscr

Re: Two profile types with OneToOneField relationship with User

2016-11-26 Thread ludovic coues
Have you tried `getattr(u, 'individualprofile', None)` ? 2016-11-26 15:17 GMT+01:00 : > Hi guys > > I'm on Django 1.10, and as described shortly here: https://dpaste.de/Bgao, I > have created an abstract user profile which is tied to Django's User model > with OneToOneField relationship. So I hav

Re: request

2016-11-27 Thread ludovic coues
What are you trying to do ? 2016-11-27 23:03 GMT+01:00 Bhanu jamwal : > i am new to it please let me know the aims and steps > regards > Bhanu > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiv

Re: Accessing to objects of a dynamic way in django template

2016-12-05 Thread ludovic coues
You could write a custom filter to apply on the queryset. 2016-12-05 1:12 GMT+01:00 Bernardo Garcia : > I have the following class based view in which I perform to queryset: > > > class PatientDetail(LoginRequiredMixin, DetailView): > >model = PatientProfile > >template_name = 'patient_det

Re: Compiling CSS to one single CSS file

2016-12-18 Thread ludovic coues
Yes, collectstatic copy static files scattered inside all your apps inside a single directory. This make it easier to serve the files directly from your apache or nginx or a different server from the one you use for django. As far as I know, django don't provide facility for turning a bunch of CSS

Re: Django stops working with RuntimeError: populate() isn't reentrant

2016-12-24 Thread ludovic coues
it's hard to tell without any code but I would bet on something akin to circular import. You could try to remove your application from INSTALLED_APPS in settings.py then put them back in one by one. This should reduce the amount of code to check. On 23 Dec 2016 9:48 a.m., "pradam programmer" wr

Re: 'RegexURLResolver' object has no attribute 'default_args'

2016-12-24 Thread ludovic coues
There is a stack trace below the error. It should provide a lot of information on where the error happened in your code On 23 Dec 2016 4:42 p.m., "jon" wrote: > I am a newbie to Django, coming from PHP/Yii. I have gotten to the part 4 > of the official Django tutorial but can't seem to get by th

Re: bug of session middleware --- session never expires

2016-12-25 Thread ludovic coues
I believe that is the intended behaviour. When I use a banking site for example, I don't want to be disconnected while doing operations 5 minutes after login in. I want the session to expire when I stop using it. Django's session middleware try to solve that use case which is what is needed 95% o

Re: existing database connectivity

2016-12-29 Thread ludovic coues
Have you done a tutorial on django ? Part 4 of the official tutorial deal with altering an object from your database according to a form. https://docs.djangoproject.com/en/1.10/intro/tutorial04/ The django girls tutorial have a section on how to create an object from a form and save it in your da

Re: Static CSS file for custom widget

2016-12-30 Thread ludovic coues
Have you looked at the media class ? https://docs.djangoproject.com/en/1.10/topics/forms/media/ 2016-12-29 13:20 GMT+01:00 Antonis Christofides : > Hello everyone, > > can a custom widget specify a static CSS file? I think the

Re: Custom Error 400/500 page in Django

2017-01-03 Thread ludovic coues
In your first exemple, you return a class but in your second exemple you return an instance of the class. That might explain the difference you notice. The documentation on HttpResponseBadRequest mention it is used like an HttpResponse object and part 3 of the django tutorial show how to render a

Re: request.read() is empty in POST

2017-01-04 Thread ludovic coues
Have you tried reading request.body ? You can use `print(repr(request.body))` to check the value of request.body. It should give you more information. I hope that help you 2017-01-04 21:06 GMT+01:00 Flávio Cardoso : > Childish? Ok, so I'm stuck, my project is stopped, nobody, no one, even YOU, > c

Re: Dynamic Models

2017-01-05 Thread ludovic coues
Would it work if the interface provide a download for a bunch of models.py file ? 2017-01-05 19:12 GMT+01:00 Vijay Khemlani : > I had to implement dynamic models for our project. > > In the end we represented them in four django models, two for the > "virtual models" and its fields and two for the

Re: Making a simple chatbot with Django

2017-01-06 Thread ludovic coues
First, if you haven't done so, do a tutorial on django. If the official one [1] doesn't suit you, I recommend the django girls one [2]. Then, write a basic django chat application. Send data from the user to django, then echo back what that line. You'll need a form sending data, like the one for a

Re: Trying to print data containing a space in html

2017-01-10 Thread ludovic coues
load only search for python module in apps specified in INSTALLED_APPS in settings.py. So either moving templatetags to the webpage folder or adding mysite to INSTALLED_APPS would help. 2017-01-10 9:57 GMT+01:00 Asad Jibran Ahmed : > Can you try moving the templatetags directory to be underneath

Re: How to give FileField's upload_to parameter a dynamic function?

2017-01-11 Thread ludovic coues
Instead of passing prefix as an argument, you could set it as an attribute of your models. Something like this: class User(AbstractUser): prefix = "mugshot" mugshot = models.ImageField('AB', upload_to= generate_attachment, ...) then generate_attachment would be something like

Re: django telebot ... !

2017-01-20 Thread ludovic coues
Please, can you send some of your code ? 2017-01-20 18:58 GMT+01:00 : > Hi ... > I have a website that powerd by django . > I can send message to my telegram channel with python client ( import > telebot ) . > But on website(django base) can't send message to channel and recive blow > error : > >

Re: dear django users & fans.. i really need ur help ok

2017-01-23 Thread ludovic coues
Computer based assessment can be all kind of thing but django should get you a long way. >From what I understand, what you need is mainly handling html form and django provide some great tools to do just that. If you need to do assessment on, say, reaction time, you might need to spend some time wi

Re: file fields

2017-01-26 Thread ludovic coues
If you want a fixed set of file field, you declare multiple file field, each with a different name. For exemple: class UserProfile(models.Model): photo_front = models.FileField(...) photo_side = models.FileField(...) If you want a list of photo, you don't know yet how many, yo

Re: Comparing two lists

2017-01-26 Thread ludovic coues
You are assuming you can have address without building. {% if x.building %} 2017-01-26 0:27 GMT+01:00 Richard Hall : > Hello, I've only just started with Django and need a bit of help steering > myself in the right direction. > > I want to create a page that has a list of possible forms that could

Re: Comparing two lists

2017-01-26 Thread ludovic coues
Building.objects.filter(addresses__street__pk=patientid) will return all buildings with an address in the same street as the patient. If I understand correctly, that is :) 2017-01-26 10:41 GMT+01:00 Richard Hall : > Thanks for replying, I need all the help I can get. What I'm trying to do is > the

Re: Moving from django 1.3 to 1.9

2017-01-27 Thread ludovic coues
You might have an easier time upgrading from one version to the next. So first check if you have some deprecation warning and fix them. Then install django 1.4, check if you have deprecation warnings, fix them. Check things are working as intended. Test really help at this point. Once you are run

<    1   2   3   4   >