Re: Can we use python related api's on the Django templates ?

2020-05-27 Thread Daniel Roseman
On Wednesday, 27 May 2020 13:21:24 UTC+1, ratnadeep ray wrote: > > Hi all, > > Currently I am trying to print the type of a variable from the Django > template html file as follows: > > The type of feature list report for version >> {%type(version)%} is > > > For the above, I am getting

Re: How to retrieve the values from the context_process.py file to template?

2020-05-26 Thread Daniel Roseman
On Tuesday, 26 May 2020 17:27:13 UTC+1, Aboyeji Solomon Adeleke wrote: > > Yes, import the get_result from the context_process.py This is entirely wrong. The point of a context processor is that it is automatically added to the template context. You shouldn't be importing it or calling it

Re: regular expression in an url showing post details

2020-05-26 Thread Daniel Roseman
On Tuesday, 26 May 2020 01:50:35 UTC+1, Tiempo wrote: > > Hi, > my name is Tiempo and I'm new with Django. currently, I'm using django > 3.0 and i want to display each article of a blog app ( like when I click on > article 1, it should display it full details on page show with the > following

Re: User.objects.all() returns only one field

2020-05-07 Thread Daniel Roseman
On Thursday, 7 May 2020 12:47:21 UTC+1, Mohsen Pahlevanzadeh wrote: > > User.objects.all() only returns one field, I need to others fields > such as first_name or last_name. > > How can I access others field? > No it doesn't. It returns a queryset of objects, each of which has all the

Re: Django URL routing

2020-05-07 Thread Daniel Roseman
You have multiple URLs that are the same path. That can't work. One URL maps to one view. -- DR. On Thursday, 7 May 2020 11:40:09 UTC+1, Ronald Kamulegeya wrote: > > I am learning Django and progressing well but i am stuck on how to > configure the different urls to view functions. > I have

AJAX request is not rendering at the client side but works perfectly at the server

2020-01-05 Thread Daniel Roseman
Why would you expect it to render anything? All your success function does is log to the console. -- DR. -- 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

Re: ModuleNotFoundError: No module named 'datetime'

2020-01-03 Thread Daniel Roseman
On Friday, 3 January 2020 17:38:27 UTC, bhushan Gupta wrote: > > I want to use Django to build a simple portal. I have done the following > on Windows 10 > installed Python 3.8 and pip > Installed virtualenv > Created an env 'cargo' > Installed Djengo 3.0.1 > Set the path: > C:\Program Files

Re: reg: How to call multiple APIView in one single web page as a list of items?

2019-12-05 Thread Daniel Roseman
On Wednesday, 4 December 2019 18:32:25 UTC, Amitesh Sahay wrote: > > I am in the process of developing a small project using django rest > framework, and within that requirement, I need to list every table in one > single page. Below is the code snippet. > > class QuizList(APIView): >

Re: Directly Accessing Dictionary Values

2019-11-22 Thread Daniel Roseman
On Wednesday, 20 November 2019 03:47:24 UTC, Andrew Stringfield wrote: > > Hello all, > > I am trying to access Dictionary values directly. Here is my view: > > def unique_key_query(request, unique_key): > unique_key_object = > simpleformmodel.objects.all().filter(id=unique_key) >

Re: how to pass user input into raw sql query ?

2019-09-07 Thread Daniel Roseman
On Friday, 6 September 2019 20:39:58 UTC+1, Bhoopesh sisoudiya wrote: > > Hi Lev dev, > > Write your query like this > > > sqlRawQuery = "Your query ... Field name= {}".format (userInput) > > Thanks > Bhoopesh Kumar > > >> >> No. Do **not** do this, ever. Use SQL parameters: query =

AttributeError 'QuerySet' object has no attribute '_meta'

2019-08-18 Thread Daniel Roseman
You can't pass *all* the objects to the form. You have to get the specific one you want to edit and pass that as the instance. -- 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,

Re: Using a 2-dimensional array in a template

2019-07-18 Thread Daniel Roseman
On Thursday, 18 July 2019 15:56:59 UTC+1, Yves de Champlain wrote: > > Indeed, it feels like I'm taking things the wrong way, maybe I coded too > much PHP to be redeemable ... > > My main problem might be coming from the fact that I need to parse the > data to generate my view and can't simply

Using a 2-dimensional array in a template

2019-07-18 Thread Daniel Roseman
You haven't really given enough context to answer the question. What are `skills` and `achievements`? How are they related, and how are either of them related to `v_table`? Normally in Django you would iterate directly over a relationship by following foreign keys - why can't you do that? Post

Querying works on shell but not on the Django program code

2019-07-11 Thread Daniel Roseman
I'm not sure why you think that a linting error would stop your code from running. Does it actually work when you run the server? If not, what error do you get then? -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: get_absolute_url() necessary with ModelForm ?

2019-07-06 Thread Daniel Roseman
On Thursday, 4 July 2019 18:45:47 UTC+1, axe...@chaos1.de wrote: > > I’m using a model in 2 apps with different urls. > Subclasing it and overwriting get_absolute_url() did not work, > because it mangled dbtable. > UpdateView does not work with ModelForm w/o get_absolute_url(). > > Does there

Re: help

2019-04-29 Thread Daniel Roseman
On Monday, 29 April 2019 17:45:48 UTC+1, Tosin Ayoola wrote: > > hello Nick, > so is there a way i can get pass this, cause i really need to get a link > to show the list of the most read information, > >> >> Nick told you exactly what to do. assignment_tag has been replaced by simple_tag. --

: (admin.E108) The value of 'list_display[0]' refers to 'title', which is not a callable, an attribute of 'PostAdmin', or an attribute or method on 'blog.Post'.

2019-01-03 Thread Daniel Roseman
Don't post pictures of code. Your Post model doesn't have any fields in it, just the two Managers. We can't see what model the fields are defined in, because your screenshot cuts that off. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Passing an ID through a Modal to delete a user in a View

2018-11-06 Thread Daniel Roseman
On Monday, 5 November 2018 11:17:49 UTC, Mauro Caresimo wrote: > > Hello Im having some issues trying to pass an id through a modal. > Basically I want to pass an id through a modal, via urls.py and to hit a > function in the views to delete the user. > This is my modal: > > Much appreciated for

Re: There's way to change "model_list" result variable name from ListView?

2018-11-01 Thread Daniel Roseman
On Wednesday, 31 October 2018 12:51:15 UTC, Fellipe Henrique wrote: > > Hi, > > Normal ListView result a list with "model"_list as name... there's any > way to change these name? > > > You can set `context_object_name` to whatever name you want. This is documented here:

Re: Recreate all tables in mysql after dropping the database

2018-09-17 Thread Daniel Roseman
On Monday, 17 September 2018 08:52:32 UTC+1, Joel wrote: > > Thank you. That is how I fixed it yesterday late night after spending > hours on it. > > For anyone else that may find it useful, > I had dropped the tables to fix this. But that ended complaining about > missing tables. Then I

Re: formaction vs get_absolute_url

2018-07-13 Thread Daniel Roseman
On Thursday, 12 July 2018 21:04:25 UTC+1, clavie...@gmail.com wrote: > > I'm looking for a way to redirect to a different page depending upon which > submit button the user clicks. I included a formaction tag in the template, > but django still demands that get_absolute_url be defined. Using

Re: Setting up Django templates

2018-05-21 Thread Daniel Roseman
On Sunday, 20 May 2018 15:31:08 UTC+1, Salty beggar wrote: > > Hi, I'm trying to set up Templates for Django. I already have models and > views that function, and now I'm trying to figure out a way to get an > actual page to show for it. > > > > The views return JSON-formatted

Re: How to operate with two models in one view?

2018-05-16 Thread Daniel Roseman
On Tuesday, 15 May 2018 12:21:26 UTC+1, Anton Smirnov wrote: > > I have two models: "Sensors" with information about its and "Measurments" . > > class Sensor(models.Model): > date_start = models.DateField() > Latitude = models.DecimalField(max_digits=18, decimal_places=15) > Longitude

Re: Adding to all templates context via Middleware

2018-05-07 Thread Daniel Roseman
I still don't understand what is being repeated or why. You need to specify that in your settings, and you can add whatever context processors you like. You don't need to specify it twice, so nothing is being repeated. -- You received this message because you are subscribed to the Google

Re: Adding to all templates context via Middleware

2018-05-03 Thread Daniel Roseman
On Thursday, 3 May 2018 01:36:26 UTC+1, Bernd Wechner wrote: > > This interests me: > > > https://teamtreehouse.com/community/django-how-can-i-retrieve-a-value-from-the-middleware > > alas no answer there, and time has changed things. > > I have checked form experience, that stuff added to

Re: AttributeError at /admin/login/

2018-04-30 Thread Daniel Roseman
n Monday, 30 April 2018 13:30:54 UTC+1, Gerald Brown wrote: > > I am getting the following error when I TRY to log in to my site > "AttributeError at /admin/login/ > > 'datetime.datetime' object has no attribute 'split'" > > This looks like a Django bug as it is in the Admin module and is NOT

Re: Creating a model instance using currently logged in user

2018-04-04 Thread Daniel Roseman
On Tuesday, 3 April 2018 22:17:34 UTC+1, Simon Connah wrote: > > Hi, > > Apologies as this is a newbie question. > > I have a Model, a CBV CreateView and a ModelForm. > > The ModelForm is set to use the model, and the model has a field called > author which is a ForeignKey to default Django

Re: Templates and URL Mappings

2018-04-02 Thread Daniel Roseman
On Monday, 2 April 2018 12:00:31 UTC+1, Will Burchell wrote: > from django.conf.urls import url > from . import views > > app_name = 'stock' # Referenced by template, ie item in index.html > > urlpatterns = [ > # /stock/ > url(r'^$', views.index, name="index"), > # /stock/nnn/ >

Re: Template.render(Context) in django 1.10+

2018-03-11 Thread Daniel Roseman
On Sunday, 11 March 2018 21:06:51 UTC, Craig de Stigter wrote: > > Hi folks > > I'm upgrading a large app from 1.8 to 1.11 and coming up against this as I > traverse through django 1.9: > > >>> from django.template import engines, Context > ... t = engines['django'].from_string('') > ...

Re: template parse error

2018-02-22 Thread Daniel Roseman
On Thursday, 22 February 2018 06:16:32 UTC, suabiut wrote: > > Could not parse the remainder: '=="1"' from 'selected_value=="1"' > > > i got the above error when passing the select value. I have no clue what > i am missing. please assist > {%if selected_value=="1"%} > > > > > Cheers, > You

Re: [1.11] Django loads sub-string url

2018-02-18 Thread Daniel Roseman
On Sunday, 18 February 2018 16:19:31 UTC, Henrik Baran wrote: > > Hi, > > I face a very weird phenomenon. I have following two urls established: > > url(r'types/$', views.types, name='types'), > url(r'box_types/$', views.box_types, name='box types') > > > If I load "/types/" the view "types" is

Migrating into Django 1.9; question about autoescape

2018-02-13 Thread Daniel Roseman
autoescape has defaulted to on since before Django 1.0; it was a massive change at the time. The only change in escaping behaviour in 1.9 was around the output of simple tags, see https://docs.djangoproject.com/en/2.0/releases/1.9/#simple-tag-now-wraps-tag-output-in-conditional-escape - this

Re: Reference field in parent model from the child in a one-to-many relationships during clean

2018-02-11 Thread Daniel Roseman
On Sunday, 11 February 2018 13:41:25 UTC, David Williamson wrote: > > Hi, > > I have two fields in a model as follows: > > society_rowid = models.ForeignKey ( > 'Organisation', on_delete=models.PROTECT, related_name='society', > blank=True, null=True, db_column='society_rowid',

Re: Get request, has PK, how do I access the PK data with in the model

2018-01-29 Thread Daniel Roseman
On Sunday, 28 January 2018 19:01:35 UTC, Travis Pickle wrote: > > I am using django 1.8. > > I read though the docs, however, i not seeing how I can get the PK other > attributes to use in model searching. > As others have stated, this is *fully* covered in the tutorial, specifically in part

Re: view user profile access restriction

2018-01-29 Thread Daniel Roseman
On Monday, 29 January 2018 05:57:55 UTC, suabiut wrote: > > I manage to fixed it. I have created two instances (profile_info and info) > in my view, i use the first instance to access the information from my > Profile model and the second instance to access th User model. I also set > the

Re: modelform DateField rendering as text

2018-01-23 Thread Daniel Roseman
On Tuesday, 23 January 2018 07:17:48 UTC, Ruchit Bhatt wrote: > > Is there any bootstrap hack to fix this ?? > You don't need a hack, you can just set the type manually: self.fields['birth_date'].widget.attrs['type'] = 'date' -- DR. -- You received this message because you are subscribed

Re: Django escapes a string partially

2018-01-22 Thread Daniel Roseman
On Monday, 22 January 2018 16:02:30 UTC, Ron Moran wrote: > > Hi there! > > I have a problem with escaping an error. > I have this unicode in python(2.7) which isn't escaped well in a span > element: > > u"'NoneType' object has no attribute 'rfind'" > The template is defined as follows: > >

Re: Using Django create() on a time.field

2018-01-07 Thread Daniel Roseman
On Sunday, 7 January 2018 21:03:05 UTC, Malik Rumi wrote: > > -- > > As a string that evaluates to the past *** > > (lifeandtimes) malikarumi@Tetuoan2:~/Projects/lifeandtimes/chronicle$ > python django_textract_9.py > > Traceback (most recent call last): > > File "django_textract_9.py", line 17,

Re: How to convert Queryset to String?

2018-01-02 Thread Daniel Roseman
On Tuesday, 2 January 2018 09:42:08 UTC, Joshua O. Morales wrote: > > Here's the snippet of my code: > models.py: > > class Comment(models.Model): > comment_title = models.TextField() > comment_content = models.TextField() > def __str__(self): > return self.comment_content > >

having trouble with django models

2017-12-16 Thread Daniel Roseman
This is expected behaviour. You've set them to be populated automatically on create and update. So there's no need to be modifiable via the admin. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: Please explain "TypeError: handle_404() got an unexpected keyword argument 'exception'"

2017-12-12 Thread Daniel Roseman
On Tuesday, 12 December 2017 17:27:03 UTC, Chris Seberino wrote: > > >>> >>> Please explain "TypeError: handle_404() got an unexpected keyword >>> argument 'exception'" >>> >> >> It means literally that "handle_404() got an unexpected keyword argument >> 'exception'", how are you calling

Re: How can I learn to make a user login?

2017-11-25 Thread Daniel Roseman
I literally just pointed you to the page in the docs that lists the login form and view. -- DR. -- 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

Re: How can I learn to make a user login?

2017-11-25 Thread Daniel Roseman
On Saturday, 25 November 2017 19:59:10 UTC, Tom Tanner wrote: > > To put it another way: Is there something like `UserCreationForm`, but for > logging in users? > > On Saturday, November 25, 2017 at 2:20:11 PM UTC-5, Tom Tanner wrote: >> >> I guess what I mean is... >> >> What’s function do I

Re: How can I learn to make a user login?

2017-11-25 Thread Daniel Roseman
On Saturday, 25 November 2017 18:57:04 UTC, Tom Tanner wrote: > > I've read this tutorial > > > on making a simple user registration form. But what about a form for just > logging in existing

Enable to display datas which are related

2017-11-17 Thread Daniel Roseman
Why have you posted pictures? Don't. -- 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

Re: DJANGO app loose path from batch file

2017-11-06 Thread Daniel Roseman
On Monday, 6 November 2017 15:43:36 UTC, Xristos Xristoou wrote: > > I try to learn more about Django celery and rabbitmq to create some async > tasks and I have some question. > > Some programs can provide PYTHON API to can some development to use > modules from this program in python. > > one

Re: Building a search form with 4 required choices, which will be inserted as arguments in an URL [warning: long question]

2017-10-29 Thread Daniel Roseman
On Monday, 23 October 2017 16:59:36 UTC+1, Jack wrote: > > This is a semi-long question. Please let me know wherever I make a > mistake. > > I'm building a search form with 4 required choices, 1 of the choices is a > CharField with a max_length of 3. The other 3 choices are ChoiceField's. >

Hello All - Wordpress to Django Python Web Developer

2017-10-06 Thread Daniel Roseman
You probably want the Djangogirls tutorial. It takes you though building a blog, and includes deploying it to a host. The early sections are a basic introduction to programming but you can skip those. Find it here: https://tutorial.djangogirls.org -- DR. -- You received this message because

Re: get_ip_address() not working when used Custom Decorators

2017-09-28 Thread Daniel Roseman
On Thursday, 28 September 2017 20:03:09 UTC+1, Mannu Gupta wrote: > > While making a customer decorator in django, the code is here :- > > def owner_required(function): > def wrap(request, *args, **kwargs): > print(request) > ip_address = get_client_ip(request) >

Re: Need help formatting and incrementing a form in HTML

2017-09-26 Thread Daniel Roseman
On Monday, 25 September 2017 21:16:04 UTC+1, Zev wrote: > > So say I have data "a", "b", and "c". It would display itself as > > Object: a > > Object: b > > Object: c > > If I added d to the form, it would add > > Object: d > > What I'm hoping to do is add an increment to this so it displays

Re: Server Side Paging...How to get the totalcount of items?

2017-09-26 Thread Daniel Roseman
On Tuesday, 26 September 2017 11:29:45 UTC+1, Rakhee Menon wrote: > > Hi , > > I was trying to do server side paging and wanted to send the totalcount of > items along with itemPerPage..I have attached my code.Can anyone suggest > how to do it?? > > Thanks in Advance. > Please don't post code

Re: capturing url pattern from html forms

2017-09-23 Thread Daniel Roseman
On Saturday, 23 September 2017 19:48:37 UTC+1, Mel DeJesus wrote: > > > Hi - > > If the number '1' is submitted with the form below, the following url is > created: http://localhost:8000/item/?id=1 > > But I continually get a page not found. How can I style the regex in the > urlpatterns so

Re: Email validation in form

2017-09-12 Thread Daniel Roseman
On Tuesday, 12 September 2017 14:18:29 UTC+1, Daniel Roseman wrote: > > On Tuesday, 12 September 2017 08:52:37 UTC+1, Moreplavec wrote: >> >> >> >>> {% csrf_token %} >>> {{ form.non_field_errors }} >>>

Re: Email validation in form

2017-09-12 Thread Daniel Roseman
On Tuesday, 12 September 2017 08:52:37 UTC+1, Moreplavec wrote: > > > >> {% csrf_token %} >> {{ form.non_field_errors }} >> {% for hidden in form.hidden_fields %} >> {{ hidden }} >> {% endfor %} >>

Re: Bizarre URL behaviour after deploying

2017-08-31 Thread Daniel Roseman
On Thursday, 31 August 2017 10:51:22 UTC+1, Tom Evans wrote: > > On Thu, Aug 31, 2017 at 2:09 AM, Bernd Wechner > wrote: > > Daniel, > > > > Yes, I have deployed, that is the problem in a sense. URLs are clean in > dev > > and suddenly contain an app_name when

Re: Bizarre URL behaviour after deploying

2017-08-30 Thread Daniel Roseman
On Wednesday, 30 August 2017 12:42:01 UTC+1, Bernd Wechner wrote: > > This has bamboozled me some. And the best thing I've found on-line doesn't > seem to apply: > > > https://stackoverflow.com/questions/26944908/django-url-mapping-how-to-remove-app-name-from-url-paths > > Let me summarise.

Re: Django deployement Apache

2017-08-29 Thread Daniel Roseman
On Tuesday, 29 August 2017 05:48:57 UTC+1, Vernon Swanepoel wrote: > > You can just copy the static files out of Django and into the static files > in your project itself. No. You should absolutely not do that. That is what the `collectstatic` command is for. -- DR. -- You received this

Re: model choice field

2017-06-22 Thread Daniel Roseman
On Thursday, 22 June 2017 09:09:24 UTC+1, shahab emami wrote: > > hello > > i have a model choice field like this: > > LEVEL_CHOICES = [ >> ('1', 'one'), >> ('2', 'two'), >> ('3', 'three'), >> ] >> >> but when i select from database and say: > > > {{object.level}} > >

Re: makemigrations running for all apps defined in INSTALLED_APPS

2017-06-06 Thread Daniel Roseman
On Tuesday, 6 June 2017 07:52:00 UTC+1, Priyanka Thakur wrote: > > Hi, > > I am migrating from Django 1.7.4 to Django 1.10.0 and is facing issue > while running migrations. > > I am running the comand : python manage.py makemigrations > > Scenario, is that we araccessing model from Oracle

Re: Installing Django

2017-06-05 Thread Daniel Roseman
On Monday, 5 June 2017 12:33:28 UTC+1, Richard Mungai wrote: > > Hi.. > I'm trying to install django using the pip command i.e (pip install > django) but i keep getting the same error message i.e "Requirement already > satisfied: django in c:\program files\python >

How to render a HTML template in App2 from App1

2017-05-29 Thread Daniel Roseman
Sorry, you should immediately delete all this code. It is horribly unsafe; you​ are storing passwords in plain text editor you must **never** do. Django already includes a secure and extendable authentication framework, which you​ should use instead. (For the record, the problem is that you

Re: Session Variables

2017-05-29 Thread Daniel Roseman
On Monday, 29 May 2017 06:04:02 UTC+1, James Schneider wrote: > > > On May 28, 2017 9:35 AM, wrote: > > > tFetchData = users.objects.get(emailid = lEmailId) > > request.session['sPassword'] = tFetchData.userroles > request.session['sCompanyId'] =

Re: Connecting django to postgresql database

2017-05-25 Thread Daniel Roseman
On Thursday, 25 May 2017 12:48:32 UTC+1, Njogu wrote: > > > however when i run the command *'python manage.py migrate'* it does not > identify the word migrate, and when i run the command '*python manage.py > syncdb*' i get the following error; > syncdb has not existed in Django since version

Re: View Function Signature?

2017-05-13 Thread Daniel Roseman
On Friday, 12 May 2017 15:11:55 UTC+1, nickeforos wrote: > > Thanks for the link. I understand these examples but still I would like to > see how a view function is defined. > > I also would like to see it in PyCharm. When I click on a view function in > PyCharm I only see: > > def

Re: get method inside class based view

2017-05-07 Thread Daniel Roseman
On Sunday, 7 May 2017 17:21:10 UTC+1, Ismail Sarenkapic wrote: > > The question is, what is the purpose of get method here,when we have post > method > is it useless in this case?If not what is function of get method? > > Why would it be useless? The get method is for GET requests, the post

Re: Django Tutorial | sqlmigrate command ending in error

2017-04-30 Thread Daniel Roseman
You haven't given nearly enough information to help you. You need at least to post the contents of your polls/migrations/0001_initial.py, and your DATABASES settings. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: add a secretballot middleware to MIDDLEWARE_CLASSES

2017-04-07 Thread Daniel Roseman
On Friday, 7 April 2017 15:46:36 UTC+1, shahab emami wrote: > > hello > i have a simple question > please help me if you can > > > i want to install this package on my project: > > https://pypi.python.org/pypi/django-secretballot/ > > I am doing the installation step by step but after adding

Re: ModelForm has no model class specified.

2017-04-05 Thread Daniel Roseman
On Tuesday, 4 April 2017 21:04:52 UTC+1, Matthew Pava wrote: > > I have a form similar to that declared below: > > > > class LineItemForm(Mixin, forms.ModelForm): > > cost = forms.FloatField() > > field_order = [‘part’, ‘cost’] > > > > class Meta: > > model = LineItem > > fields =

Re: Not able to paginate with TemplateResponseMixin view

2017-04-02 Thread Daniel Roseman
On Sunday, 2 April 2017 15:23:35 UTC+1, Rajesh Benjwal wrote: > > I was trying to paginate course list view but not able to do it. I tried > puting paginated_by in views and this > > http://dpaste.de/7Mea > > code in the template but it seems like it does work that way and I am > missing

Re: What was the rationale behind ClassBasedView.as_view()

2017-03-13 Thread Daniel Roseman
On Monday, 13 March 2017 18:36:46 UTC, Frederik Creemers wrote: > > Django views are just functions that take a request, and possibly some > other args, and return a response. To get such a view from a class based > view, you can `as_view()` on it. Why is that? Wouldn't it make the code >

Postgres (sqlmigrate) FK to M2M without RunPython

2017-03-07 Thread Daniel Roseman
Schema migrations don't run on the database server, they run on the app server with the rest of your Django code and communicate with the database in exactly the same way. If you can run Django, you can run migrations. -- DR. -- You received this message because you are subscribed to the

Re: Iframe'd page in Django template can't find it's Javascript or CSS files, 404 error

2017-03-04 Thread Daniel Roseman
On Saturday, 4 March 2017 15:57:49 UTC, Tom Tanner wrote: > > >How are you referring to the assets in the template? > > In `interactive/index.html`, in the `` tag, I have ` src="scripts/main.js">` > Well, if you wanted to load the scripts from /interactive-1/scripts/main.js, then that's what you

Re: Iframe'd page in Django template can't find it's Javascript or CSS files, 404 error

2017-03-04 Thread Daniel Roseman
On Saturday, 4 March 2017 13:30:37 UTC, Tom Tanner wrote: > > In my `views.py`, I have one path render an html file: > > def interactive(request): > if request.session.get('interactiveID') == None: > t= get_template('blank-interactive.html') > else: > interactive_template=

Re: group by 3 fields

2017-02-26 Thread Daniel Roseman
On Sunday, 26 February 2017 11:11:39 UTC, larry@gmail.com wrote: > > Order by is not the same as group by. Group by does aggregation > > You should explain what you want to achieve. Grouping is pointless on its own. In any case, when working with an ORM like Django's it is generally not

Re: PostgreSQL get_object_or_404 matching query does not exist when indeed it does?

2017-02-18 Thread Daniel Roseman
On Saturday, 18 February 2017 17:37:49 UTC, Nikoleta Misheva wrote: > > I am querying PostgreSQL using *get_object_or_404 * but it throws and > exception *PairUsers matching query does not exist *and after that *During > handling of the above exception, another exception >

Re: issue with django's example version 1.10 in windows 7 ultimate

2017-02-05 Thread Daniel Roseman
The instructions say to go to http://localhost:8000/polls/ in your browser. You're going to http://localhost:8000/, but there's nothing defined for that URL. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: form_invalid

2017-01-30 Thread Daniel Roseman
This is bad advice. You should almost never need to override the get or post methods on a class based view; there are always more specific methods to use. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread Daniel Roseman
On Monday, 16 January 2017 15:53:56 UTC, Peter Müller wrote: > > For the traceback: http://pastebin.com/Wy7And6M > And the views configuration: http://pastebin.com/q0V3bQay > > > thanks > > Peter > The traceback shows that you are importing your views module in the __init__.py of your app.

Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread Daniel Roseman
On Sunday, 15 January 2017 18:03:54 UTC, Peter Müller wrote: > > Hello everybody. > > > I just began learning how to use django. So I wanted to include data from > the database in a testwebsite. > Therefore I made a new app and created a model called "user" and a view > that should fill a

Showing user's data on page

2017-01-02 Thread Daniel Roseman
This isn't a custom user model, it's a related model - what would normally be called a user profile. Regardless, there *is* a reference from User to CustomUser, via the one-to-one relation: you can just do `user.customuser`. -- DR. -- You received this message because you are subscribed to

Re: ImageField always calling update_dimensions_fields

2016-12-04 Thread Daniel Roseman
On Sunday, 4 December 2016 00:47:06 UTC, ggi...@gmail.com wrote: > > > I needed to get to the width and height of an image. After discovering > that doing so on an ImageField loads the file, I added width_field and > height_field to my model. > > I did a migration and starting using the new

Re: wsgiref - When does the complexity of question require posting to the Developers or other forums?

2016-12-01 Thread Daniel Roseman
On Thursday, 1 December 2016 13:16:07 UTC, NoviceSortOf wrote: > > > > Hi All, > > After hours of looking for solutions, here on Stackoverflow, GitHub, > Django site and other forums, > and seeing that at least 2 other posts related to what per web chatter > appears to be a known > bug in Django

How does django pass data through post?

2016-11-29 Thread Daniel Roseman
The problem is in your html. Browsers can only send data for inputs with a `name` attribute, which Django then uses as the key in the querydict, whereas the `value` attribute becomes the value for that key. None of your inputs have names. It also doesn't make sense to add the id to the form or

Re: how to run django under apache on windows 10

2016-11-18 Thread Daniel Roseman
On Friday, 18 November 2016 13:58:41 UTC, bob gailer wrote: > > Goal: run django under apache on windows 10. I have tried many things, > none of which have worked. Errror messages up to wazoo. Google has not > been my friend: I found a lot of articles Everything I read is either > oriented to

Re: Regex Validators doesn't validate while working in a shell

2016-09-12 Thread Daniel Roseman
On Monday, 12 September 2016 14:36:23 UTC+1, ashish...@finoit.co.in wrote: > > I've configured user's username field in following way > > username = models.CharField( > _('username'), > max_length=30, > unique=True, > help_text=_('Required. 30 characters or fewer.

Re: Validators and django.contrib.postgres.fields JSONField

2016-08-28 Thread Daniel Roseman
On Sunday, 28 August 2016 07:54:47 UTC+1, Ryan Causey wrote: > > So I've dug into this a little more, and I've come up with the debugger > trace below. > > -> dummyModelInstance.full_clean() > c:\program files\python35\lib\site-packages\django\db\models\base.py( > 1210)full_clean() > ->

Re: How to start Django app with apache server

2016-08-07 Thread Daniel Roseman
There is no equivalent. If you're following those instructions, Django will run via Apache. -- 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

Re: How to implement a ManyToManyField with a View

2016-05-28 Thread Daniel Roseman
On Thursday, 26 May 2016 18:43:00 UTC+1, Bruce Whealton wrote: > > Hello all, > I started a similar thread but couldn't find it. > I was creating a Personal Information Management Project, with Project > name mypim. My first app was a contacts app. > This has two Class based Models in the

Re: Django API CSRF Issues - Need Help

2016-05-21 Thread Daniel Roseman
On Saturday, 21 May 2016 02:36:15 UTC+1, Chris Troutner wrote: > > Hey all, > > This is my first time posting to the group. I'm working with Bob Hagan > on the Network Resource Planning (NRP) > project . The platform runs on >

Re: scarico() got an unexpected keyword argument 'string'

2016-04-23 Thread Daniel Roseman
On Friday, 22 April 2016 15:41:29 UTC+1, Steven Crockett wrote: > > > def scarico(request, data): > print(data) > > You are expecting two positional arguments, and no keyword arguments. > To properly capture your keyword argument named "my_string" your > definition should be written as: > >

Re: Can not read request.body from a POST request

2016-04-23 Thread Daniel Roseman
On Wednesday, 20 April 2016 21:29:09 UTC+1, Mihai Corciu wrote: > > Is there a method to access request.body from a POST request in Django, > without disabling 'django.middleware.csrf.CsrfViewMiddleware' ? > > CsrfViewMiddleware is causing: > > Exception Type: RawPostDataException > Exception

How to know which models have changed and need make migrations?

2016-04-07 Thread Daniel Roseman
You shouldn't ever need to make migrations in production. You make them in dev, commit to source control, deploy along with the rest of the code, then run the migrations in prod. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

django dynamically updating dashboard

2016-03-28 Thread Daniel Roseman
You're going to need to give much more detail. What do you mean by a dashboard? What data do you want to update, and where is it coming from? What is dynamic about it? Why do you think you need Celery? -- DR. -- You received this message because you are subscribed to the Google Groups

Re: Trouble with objects.all() and objects.get()

2016-03-13 Thread Daniel Roseman
On Sunday, 13 March 2016 20:01:52 UTC, NoviceSortOf wrote: > > > I can't manage to figure out why I consistently get a syntax error when > attempted to > use objects.all or objects.get. > > From my code in view.py > > >>from books.modelsimport Interests > > The Interests model imports

Database migrations

2016-03-04 Thread Daniel Roseman
What are you expecting to happen? The message is quite clear, and offers the only two possible options. Are neither of those suitable? Why not? What other action would you like to take? -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: problem deploying two apps

2016-03-01 Thread Daniel Roseman
On Tuesday, 1 March 2016 16:56:57 UTC, frocco wrote: > > Hi, > > I followed this > https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/modwsgi/ > > First app works fine, if I deploy the second app, the settings conflict > and images are not rendered. > > [code] > Alias /static

Managing the Django Sqlite development db with respect to Git

2016-02-25 Thread Daniel Roseman
Why do you want your db in version control at all? There is not normally a good reason to do that. -- DR. -- 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

Re: Django error: migrations not working

2016-02-18 Thread Daniel Roseman
On Thursday, 18 February 2016 12:14:54 UTC, Jasleen Kaur wrote: > > I am unable to do any migrations in any django project. Need help. > > $python manage.py makemigrations > No changes detected > > $django-admin check > ... > ... > django.core.exceptions.ImproperlyConfigured: Requested setting >

Re: ./manage.py runserver 0.0.0.0:8080 is not working, No module named django.core.management

2016-02-09 Thread Daniel Roseman
On Tuesday, 9 February 2016 17:02:25 UTC, John Travolta wrote: > > Hi, > in the past I succeeded to start python server but now I changed VPS and I > can't do it. > > here is what I get, i tried to find an answer with google but no success: > > *./manage.py runserver 0.0.0.0:8080

Re: Adding a field to a model after initial migration

2016-01-28 Thread Daniel Roseman
On Wednesday, 27 January 2016 21:29:18 UTC, ofeyofey wrote: > > No problem. Thanks for your help. > Maybe fields can't be added to a model with django. > I will try dropping the table in the DB and see what happens. > Thanks again, > Adding fields to models is quite literally what migrations are

  1   2   3   4   5   6   7   8   9   10   >