Django Forms

2017-10-21 Thread test
Hi, I have a form that contains a question and a multiple choice answer field. For example: What is your favorite color? - Blue - Green - Red - Yellow I render the page with a list of forms (or I guess formset?) and loop through them. So something like this. for form in formset:

Re: Django Forms

2017-10-21 Thread test
class PollForm(forms.Form): answer = forms.ChoiceField( widget=forms.RadioSelect, choices=cool_choices) def __init__(self, poll, *args, **kwargs): super(PollForm, self).__init__(*args, **kwargs) b = poll.choice_set.all() list_choice = [] fo

How do you access parent object values in an admin inline

2017-11-22 Thread test
For example: class AnswerInLine(admin.TabularInline): model = Answers class QuestionAdmin(admin.ModelAdmin): inlines = [AnswerInLine] I want to change the model in the AnswerInLine depending on what the QuestionAdmin value is -- You received this message because you are subscribed

Re: How do you access parent object values in an admin inline

2017-11-22 Thread test
M UTC-5, Matemática A3K wrote: > > > > On Wed, Nov 22, 2017 at 3:21 PM, test > > wrote: > >> For example: >> >> class AnswerInLine(admin.TabularInline): >> model = Answers >> >> class QuestionAdmin(admin.ModelAdmin): >>

How to store a boolean expression (parse tree) in a model?

2020-02-18 Thread test
Let's say I have: Calculator #1: Expression: (True AND False) AND (True OR False) This expression should be a child of some calculator. class Calculator(models.Model): name = ... class Expression(models.Model): parent = models.ForeignKey(Calculator) boolean = AND or OR sub_exp1 = models.Fore

Re: How to store a boolean expression (parse tree) in a model?

2020-02-19 Thread test
to efficiently > store > such data. > > Cheers, > Simon > > [0] https://djangopackages.org/grids/g/trees-and-graphs/ > [1] https://www.postgresql.org/docs/current/sql-createtype.html > > Le mardi 18 février 2020 18:13:39 UTC-5, test a écrit : >> >> Let's

Label in Charfield

2015-07-20 Thread Info Test
Hello, What is the best way to add class css for a label in Charfield form? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googl

Can't update extended user django model

2015-07-21 Thread Info Test
When I save my model, there is no effect in database. What is the problem? class Profil(models.Model): user = models.OneToOneField(User) in manage.py shell >>> p = models.Profil.objects.get(user__username='testname') >>> p.user.is_superuser False >>> p.user.is_superuser = True >>> p.user.i

Re: Can't update extended user django model

2015-07-21 Thread Info Test
Le mardi 21 juillet 2015 10:55:19 UTC+3, Info Test a écrit : > > When I save my model, there is no effect in database. > What is the problem? > > class Profil(models.Model): > user = models.OneToOneField(User) > > > in manage.py shell > > >>> p

Re: Can't update extended user django model

2015-07-21 Thread Info Test
Even with p.save(force_update = True) , it doesn't work -- 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 thi

Re: Can't update extended user django model

2015-07-21 Thread Info Test
Any error appear on console, is it possible that only superuser can do that? -- 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...@googlegroup

Re: Can't update extended user django model

2015-07-21 Thread Info Test
Thanks for all your answers. Solution : http://stackoverflow.com/questions/31534715/cant-update-extended-user-django-model -- 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

Use django-console app url in template

2015-07-23 Thread Info Test
I can access to django-console app with: 127.0.0.1:8000/admin/console. How to link this with href = "url " in 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

Re: Unit-Testing Django Views

2019-03-30 Thread Test Bot
Thanks everyone for the clearance of the problem. I will remove the unit test's logic to check fir template, it seems a viable test case along with the status code value. On Fri, Mar 29, 2019, 2:24 AM Chetan Ganji wrote: > There is one more way you could do it > > > class

Re: Unit-Testing Django Views

2019-03-30 Thread Test Bot
* === python superlists/manage.py test Creating test database for alias 'default'... System check identified no issues (0 silenced). .F. Destroying test database for alias 'default'... ===

Re: Unit-Testing Django Views

2019-03-30 Thread Test Bot
Sorry for the bother but I finally solved it by using Django's Test Client and checking for status_code and template used to render the response in my unit-test. Regards, Test Bot On Sat, Mar 30, 2019 at 5:00 PM Test Bot wrote: > I tried removing the {% csrf_token %} from my index.htm

Re: how can i get current username in model field ??

2019-04-01 Thread Test Bot
+1 DoesNotMakesSenseError("Author of any comment should not be related to the currently logged in user") On Mon, Apr 1, 2019, 7:09 PM Joel Mathew wrote: > This does not make sense to me. A model is not a dynamic entity. It is > something that's created beforehand. Getting the current username in

Re: I have created a Django App, How to create a Django App Launcher?

2019-04-09 Thread Test Bot
The issue here is you have a web app and you expect a desktop application. This should be asked on a GUI-Framework mailing list. You can call your APIs from that desktop app instead of writing the same code again(DRY). On Tue, Apr 9, 2019, 8:42 PM Julio Cojom wrote: > Django Is a web applicatio

Re: Failed to understand syntax

2019-04-12 Thread Test Bot
The part you want to understand is same as ORDER BY clause in SQL. The slicing will provide only the top 5 results. By default the order_by sorts in ascending order only. But providing a "-" would make it to sort in descending order. On Fri, Apr 12, 2019, 6:56 PM Mayur Bagul wrote: > Hello coder

Re: Failed to understand syntax

2019-04-13 Thread Test Bot
That is because Question.objects.order_by("-pub_date") would give you a list of all records so you can simply apply slicing without the use of . operator. For understanding purpose, you can break down your code as result = Question.objects.order_by("-pub_date") > latest_question_list = result[:

Re: Failed to push Django project on github using gitbash

2019-04-18 Thread Test Bot
It means your remote has some changes that are not there in your local so when you are pushing, git is unable to merge those changes. Try a git pull then local merge and then push. Feel free to ask in case of any queries. On Thu, Apr 18, 2019, 6:58 PM Mayur Bagul wrote: > Hello Community, > > i

Re: Can Anyone Please Provide djago-select2 Documentation

2019-05-14 Thread Test Bot
Okay so there is no need to go to different websites if you want to install a Python module. You will find almost everything related to Python modules in pypi.org, it includes everything like installation instructions, gut repo for the packages etc On Wed, May 15, 2019, 11:57 AM Balaji Shetty wro

Re: could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

2019-05-16 Thread Test Bot
Did you check your firewall settings? On Thu, May 16, 2019, 6:37 PM Rob W wrote: > First, you should not share your password to your server to anyone….thats > very dangerous. Now anyone can log in to your server with nefarious > intentions. > Be more careful. > > But it sounds like something on

Re: Getting MultiValueDictKeyError

2019-05-16 Thread Test Bot
Try putting encrypt="multipart/form-data" in your form tag On Thu, May 16, 2019, 6:05 PM Sipum wrote: > Hi Friends, > > when retrieving file that is uploaded , I'm getting multiValueDictKeyError. > Below are my codes. I have proided some codes where I m getting error. > could anyone help me here

Re: could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

2019-05-16 Thread Test Bot
So one check would be to see all the connections that are allowed by your firewall. On Thu, May 16, 2019, 6:45 PM omar ahmed wrote: > no but can it struggle it ? > how can i check it > > On Thursday, May 16, 2019 at 3:09:55 PM UTC+2, OnlineJudge95 wrote: >> >> Did you check your firewall setting

Re: Anyone kind enough to help me understand these few concepts

2019-05-16 Thread Test Bot
Hi In models you have to define your database tables as class and any response to the user should be handled in views.py You can introduce randomness via random module or for any customisation you can write it as a different app altogether. You can create your coin as a separate model and attach

Re: reg: Django model sequense of the fields

2019-05-17 Thread Test Bot
[Just Curious] would it matter in any way what the position of field is in the respective tables. On Fri, May 17, 2019, 5:46 PM 'Akash Sinha' via Django users < django-users@googlegroups.com> wrote: > Hello > > This happens for 2 reasons > > 1st. Those fields might be Foreign key, Foreign key fie

Should there be separate django app for every user type in a django project?

2019-10-13 Thread test user
Hi, I have got multiple user types(around 4 to 5) in my Django project. Should i make separate Django app for each user type? Each user type will have different interface after they log into the website. -- You received this message because you are subscribed to the Google Groups "Django user

Re: Should there be separate django app for every user type in a django project?

2019-10-14 Thread test user
ntation in django for further > details. > > I hope this helps. > > > > On Sun, Oct 13, 2019, 8:33 PM test user > > wrote: > >> Hi, >> >> I have got multiple user types(around 4 to 5) in my Django project. >> Should i make separate Django app

LookupError: No installed app with label 'admin'.

2019-05-19 Thread This is a test message
Hi, I am new to django and am trying out the tutorial. Get the following error: 1. Create a virtual environment using anaconda 2. Activate the virtual environment 3. Create the project 4. Get the following error when trying to start the server: Directory of C:\Users\bradl\Documents\web sites\poll